nuva 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +3 -0
- data/.rubocop.yml +116 -0
- data/Rakefile +12 -0
- data/gen_proto.sh +9 -0
- data/lib/{Code_pb.rb → nuva/Code_pb.rb} +3 -3
- data/lib/{Disease_pb.rb → nuva/Disease_pb.rb} +6 -6
- data/lib/{InjectionMethod_pb.rb → nuva/InjectionMethod_pb.rb} +1 -1
- data/lib/{NuvaDatabase_pb.rb → nuva/NuvaDatabase_pb.rb} +4 -4
- data/lib/{Vaccine_pb.rb → nuva/Vaccine_pb.rb} +9 -9
- data/lib/{Valence_pb.rb → nuva/Valence_pb.rb} +8 -8
- data/lib/{VersionInfo_pb.rb → nuva/VersionInfo_pb.rb} +4 -4
- data/lib/{queries.rb → nuva/queries.rb} +30 -56
- data/lib/{repositories → nuva/repositories}/disease_repository.rb +2 -0
- data/lib/{repositories → nuva/repositories}/vaccine_repository.rb +2 -0
- data/lib/{repositories → nuva/repositories}/valence_repository.rb +1 -0
- data/lib/{repository.rb → nuva/repository.rb} +2 -0
- data/lib/nuva/version.rb +5 -0
- data/lib/nuva.rb +12 -7
- data/nuva.gemspec +35 -14
- data/sig/nuva.rbs +4 -0
- metadata +32 -26
- data/lib/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91add977fc84455f8034b67572e407e66fc72883f2bb4222a1110d075f8f5fa6
|
4
|
+
data.tar.gz: 613fcbda7fe1c0700c966f86d76795629325919ff47e36b14a3ff5c40e74ff35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1ad7b17c479dd8721b145407b2680389179d397873560b511f9014ea9a113beef0896ffc84865e5ced911f1b91afa06b0defa7f5d971b8e2ea6594e941c1882
|
7
|
+
data.tar.gz: a657ba25891700583e6c219bef5677977c42a860f1d6e64c6b96bc08ce6aae8b0e6f517733d4f9a64503489d20424f08bfabb9b5cad9bce4c611e939e9eded51
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
TargetRubyVersion: 3.2
|
6
|
+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
7
|
+
# to ignore them, so only the ones explicitly set in this file are enabled.
|
8
|
+
DisabledByDefault: true
|
9
|
+
Exclude:
|
10
|
+
- "**/vendor/**/*"
|
11
|
+
- "**/*_pb.rb"
|
12
|
+
|
13
|
+
# Prefer &&/|| over and/or.
|
14
|
+
Style/AndOr:
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
Layout:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
21
|
+
Style/HashSyntax:
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
Style/DefWithParentheses:
|
25
|
+
Enabled: true
|
26
|
+
|
27
|
+
# Defining a method with parameters needs parentheses.
|
28
|
+
Style/MethodDefParentheses:
|
29
|
+
Enabled: true
|
30
|
+
|
31
|
+
Style/FrozenStringLiteralComment:
|
32
|
+
Enabled: true
|
33
|
+
EnforcedStyle: always
|
34
|
+
|
35
|
+
Layout/EmptyLineAfterMagicComment:
|
36
|
+
Enabled: true
|
37
|
+
|
38
|
+
Style/RedundantFreeze:
|
39
|
+
Enabled: true
|
40
|
+
|
41
|
+
# Use quotes for string literals when they are enough.
|
42
|
+
Style/RedundantPercentQ:
|
43
|
+
Enabled: true
|
44
|
+
|
45
|
+
Style/StringLiterals:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Lint/AmbiguousOperator:
|
49
|
+
Enabled: true
|
50
|
+
|
51
|
+
Lint/AmbiguousRegexpLiteral:
|
52
|
+
Enabled: true
|
53
|
+
|
54
|
+
Lint/ErbNewArguments:
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
58
|
+
Lint/RequireParentheses:
|
59
|
+
Enabled: true
|
60
|
+
|
61
|
+
Lint/ShadowingOuterLocalVariable:
|
62
|
+
Enabled: true
|
63
|
+
|
64
|
+
Lint/RedundantStringCoercion:
|
65
|
+
Enabled: true
|
66
|
+
|
67
|
+
Lint/UriEscapeUnescape:
|
68
|
+
Enabled: true
|
69
|
+
|
70
|
+
Lint/UselessAssignment:
|
71
|
+
Enabled: true
|
72
|
+
|
73
|
+
Lint/DeprecatedClassMethods:
|
74
|
+
Enabled: true
|
75
|
+
|
76
|
+
Style/ParenthesesAroundCondition:
|
77
|
+
Enabled: true
|
78
|
+
|
79
|
+
Style/RedundantBegin:
|
80
|
+
Enabled: false
|
81
|
+
|
82
|
+
Style/RedundantReturn:
|
83
|
+
Enabled: true
|
84
|
+
AllowMultipleReturnValues: true
|
85
|
+
|
86
|
+
Style/Semicolon:
|
87
|
+
Enabled: true
|
88
|
+
AllowAsExpressionSeparator: true
|
89
|
+
|
90
|
+
# Prefer Foo.method over Foo::method
|
91
|
+
Style/ColonMethodCall:
|
92
|
+
Enabled: true
|
93
|
+
|
94
|
+
Style/TrivialAccessors:
|
95
|
+
Enabled: true
|
96
|
+
|
97
|
+
Performance/FlatMap:
|
98
|
+
Enabled: true
|
99
|
+
|
100
|
+
Performance/RedundantMerge:
|
101
|
+
Enabled: true
|
102
|
+
|
103
|
+
Performance/StartWith:
|
104
|
+
Enabled: true
|
105
|
+
|
106
|
+
Performance/EndWith:
|
107
|
+
Enabled: true
|
108
|
+
|
109
|
+
Performance/RegexpMatch:
|
110
|
+
Enabled: true
|
111
|
+
|
112
|
+
Performance/ReverseEach:
|
113
|
+
Enabled: true
|
114
|
+
|
115
|
+
Performance/UnfreezeString:
|
116
|
+
Enabled: true
|
data/Rakefile
ADDED
data/gen_proto.sh
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
find ../nuva -type f -name '*.proto' -exec basename {} \; | xargs protoc --ruby_out=./lib/nuva -I ../nuva
|
4
|
+
|
5
|
+
if [ `uname` = 'Darwin' ]; then
|
6
|
+
sed -i '' -E "s/^require '([a-zA-Z_]+)'/require_relative '\1'/" ./lib/nuva/*_pb.rb
|
7
|
+
else
|
8
|
+
sed -i -E "s/^require '([a-zA-Z_]+)'/require_relative '\1'/" ./lib/nuva/*_pb.rb
|
9
|
+
fi
|
@@ -4,10 +4,10 @@
|
|
4
4
|
require 'google/protobuf'
|
5
5
|
|
6
6
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
-
add_file("Code.proto", :syntax => :
|
7
|
+
add_file("Code.proto", :syntax => :proto3) do
|
8
8
|
add_message "nuva.Code" do
|
9
|
-
|
10
|
-
|
9
|
+
optional :nomenclature, :string, 1
|
10
|
+
optional :value, :string, 2
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -7,14 +7,14 @@ require 'google/protobuf/timestamp_pb'
|
|
7
7
|
require_relative 'Code_pb'
|
8
8
|
|
9
9
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
10
|
-
add_file("Disease.proto", :syntax => :
|
10
|
+
add_file("Disease.proto", :syntax => :proto3) do
|
11
11
|
add_message "nuva.Disease" do
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
optional :id, :string, 1
|
13
|
+
optional :name, :string, 2
|
14
|
+
optional :code, :uint32, 3
|
15
15
|
repeated :codes, :message, 4, "nuva.Code"
|
16
|
-
|
17
|
-
|
16
|
+
optional :vaccinable, :bool, 5
|
17
|
+
optional :screenable, :bool, 6
|
18
18
|
repeated :valence_ids, :string, 7
|
19
19
|
optional :created_at, :message, 16, "google.protobuf.Timestamp"
|
20
20
|
optional :updated_at, :message, 17, "google.protobuf.Timestamp"
|
@@ -4,7 +4,7 @@
|
|
4
4
|
require 'google/protobuf'
|
5
5
|
|
6
6
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
-
add_file("InjectionMethod.proto", :syntax => :
|
7
|
+
add_file("InjectionMethod.proto", :syntax => :proto3) do
|
8
8
|
add_enum "nuva.InjectionMethod" do
|
9
9
|
value :UnspecifiedInjectionMethod, 0
|
10
10
|
value :Intramuscular, 1
|
@@ -10,11 +10,11 @@ require_relative 'Disease_pb'
|
|
10
10
|
require_relative 'Valence_pb'
|
11
11
|
|
12
12
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
13
|
-
add_file("NuvaDatabase.proto", :syntax => :
|
13
|
+
add_file("NuvaDatabase.proto", :syntax => :proto3) do
|
14
14
|
add_message "nuva.NuvaDatabase" do
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
optional :version, :message, 1, "nuva.VersionInfo"
|
16
|
+
optional :generated_at, :message, 2, "google.protobuf.Timestamp"
|
17
|
+
optional :locale, :string, 3
|
18
18
|
repeated :vaccines, :message, 4, "nuva.Vaccine"
|
19
19
|
repeated :diseases, :message, 5, "nuva.Disease"
|
20
20
|
repeated :valences, :message, 6, "nuva.Valence"
|
@@ -8,21 +8,21 @@ require_relative 'InjectionMethod_pb'
|
|
8
8
|
require_relative 'Code_pb'
|
9
9
|
|
10
10
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
11
|
-
add_file("Vaccine.proto", :syntax => :
|
11
|
+
add_file("Vaccine.proto", :syntax => :proto3) do
|
12
12
|
add_message "nuva.Vaccine" do
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
optional :id, :string, 1
|
14
|
+
optional :name, :string, 2
|
15
|
+
optional :short_description, :string, 3
|
16
|
+
optional :description, :string, 4
|
17
17
|
repeated :injection_methods, :enum, 5, "nuva.InjectionMethod"
|
18
|
-
|
18
|
+
optional :code, :uint32, 6
|
19
19
|
repeated :codes, :message, 7, "nuva.Code"
|
20
20
|
repeated :valence_ids, :string, 8
|
21
21
|
repeated :other_names, :string, 9
|
22
|
-
|
22
|
+
optional :generic, :bool, 10
|
23
23
|
optional :replaced_by_id, :string, 11
|
24
|
-
|
25
|
-
|
24
|
+
optional :created_at, :message, 16, "google.protobuf.Timestamp"
|
25
|
+
optional :updated_at, :message, 17, "google.protobuf.Timestamp"
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -6,19 +6,19 @@ require 'google/protobuf'
|
|
6
6
|
require 'google/protobuf/timestamp_pb'
|
7
7
|
|
8
8
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
-
add_file("Valence.proto", :syntax => :
|
9
|
+
add_file("Valence.proto", :syntax => :proto3) do
|
10
10
|
add_message "nuva.Valence" do
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
optional :id, :string, 1
|
12
|
+
optional :parent_id, :string, 2
|
13
|
+
optional :code, :uint32, 3
|
14
|
+
optional :name, :string, 4
|
15
|
+
optional :abbreviation, :string, 5
|
16
16
|
optional :translated_abbreviation, :string, 6
|
17
17
|
repeated :disease_ids, :string, 7
|
18
18
|
repeated :vaccine_ids, :string, 8
|
19
19
|
optional :antigene_type, :string, 9
|
20
|
-
|
21
|
-
|
20
|
+
optional :created_at, :message, 16, "google.protobuf.Timestamp"
|
21
|
+
optional :updated_at, :message, 17, "google.protobuf.Timestamp"
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -4,11 +4,11 @@
|
|
4
4
|
require 'google/protobuf'
|
5
5
|
|
6
6
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
-
add_file("VersionInfo.proto", :syntax => :
|
7
|
+
add_file("VersionInfo.proto", :syntax => :proto3) do
|
8
8
|
add_message "nuva.VersionInfo" do
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
optional :major, :uint32, 1
|
10
|
+
optional :minor, :uint32, 2
|
11
|
+
optional :patch, :uint32, 3
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fuzzy_match'
|
2
4
|
|
3
5
|
module Nuva
|
4
6
|
module Queries
|
5
7
|
class ValencesByVaccine
|
6
8
|
def initialize(repositories)
|
7
|
-
|
8
|
-
@valences_by_vaccine_id = repositories[:valences].all.reduce(
|
9
|
+
hash = Hash.new { |h, k| h[k] = [] }
|
10
|
+
@valences_by_vaccine_id = repositories[:valences].all.reduce(hash) do |acc, valence|
|
9
11
|
valence.vaccine_ids.each do |vaccine_id|
|
10
12
|
acc[vaccine_id] << valence
|
11
13
|
end
|
@@ -20,8 +22,8 @@ module Nuva
|
|
20
22
|
|
21
23
|
class VaccinesByValence
|
22
24
|
def initialize(repositories)
|
23
|
-
|
24
|
-
@vaccines_by_valence_id = repositories[:vaccines].all.reduce(
|
25
|
+
hash = Hash.new { |h, k| h[k] = [] }
|
26
|
+
@vaccines_by_valence_id = repositories[:vaccines].all.reduce(hash) do |acc, vaccine|
|
25
27
|
vaccine.valence_ids.each do |valence_id|
|
26
28
|
acc[valence_id] << vaccine
|
27
29
|
end
|
@@ -36,8 +38,8 @@ module Nuva
|
|
36
38
|
|
37
39
|
class VaccinesByDisease
|
38
40
|
def initialize(repositories)
|
39
|
-
|
40
|
-
@vaccines_by_disease_id = repositories[:valences].all.reduce(
|
41
|
+
hash = Hash.new { |h, k| h[k] = [] }
|
42
|
+
@vaccines_by_disease_id = repositories[:valences].all.reduce(hash) do |acc, valence|
|
41
43
|
valence.disease_ids.each do |disease_id|
|
42
44
|
valence.vaccine_ids.each do |vaccine_id|
|
43
45
|
acc[disease_id] << repositories[:vaccines].find(vaccine_id)
|
@@ -48,14 +50,14 @@ module Nuva
|
|
48
50
|
end
|
49
51
|
|
50
52
|
def call(disease)
|
51
|
-
@vaccines_by_disease_id[disease.id]
|
53
|
+
@vaccines_by_disease_id[disease.id].uniq(&:id)
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
55
57
|
class ValencesByDisease
|
56
58
|
def initialize(repositories)
|
57
|
-
|
58
|
-
@valences_by_disease_id = repositories[:valences].all.reduce(
|
59
|
+
hash = Hash.new { |h, k| h[k] = [] }
|
60
|
+
@valences_by_disease_id = repositories[:valences].all.reduce(hash) do |acc, valence|
|
59
61
|
valence.disease_ids.each do |disease_id|
|
60
62
|
acc[disease_id] << valence
|
61
63
|
end
|
@@ -70,8 +72,8 @@ module Nuva
|
|
70
72
|
|
71
73
|
class DiseasesByVaccine
|
72
74
|
def initialize(repositories)
|
73
|
-
|
74
|
-
@diseases_by_vaccine_id = repositories[:valences].all.reduce(
|
75
|
+
hash = Hash.new { |h, k| h[k] = [] }
|
76
|
+
@diseases_by_vaccine_id = repositories[:valences].all.reduce(hash) do |acc, valence|
|
75
77
|
valence.vaccine_ids.each do |vaccine_id|
|
76
78
|
valence.disease_ids.each do |disease_id|
|
77
79
|
acc[vaccine_id] << repositories[:diseases].find(disease_id)
|
@@ -82,14 +84,14 @@ module Nuva
|
|
82
84
|
end
|
83
85
|
|
84
86
|
def call(vaccine)
|
85
|
-
@diseases_by_vaccine_id[vaccine.id]
|
87
|
+
@diseases_by_vaccine_id[vaccine.id].uniq(&:id)
|
86
88
|
end
|
87
89
|
end
|
88
90
|
|
89
91
|
class DiseasesByValence
|
90
92
|
def initialize(repositories)
|
91
|
-
|
92
|
-
@diseases_by_valence_id = repositories[:diseases].all.reduce(
|
93
|
+
hash = Hash.new { |h, k| h[k] = [] }
|
94
|
+
@diseases_by_valence_id = repositories[:diseases].all.reduce(hash) do |acc, disease|
|
93
95
|
disease.valence_ids.each do |valence_id|
|
94
96
|
acc[valence_id] << disease
|
95
97
|
end
|
@@ -104,8 +106,8 @@ module Nuva
|
|
104
106
|
|
105
107
|
class VaccineFuzzySearch
|
106
108
|
def initialize(repositories)
|
107
|
-
@engine = FuzzyMatch.new(repositories.vaccines.all, :
|
108
|
-
|
109
|
+
@engine = FuzzyMatch.new(repositories.vaccines.all, read: ->(v) {
|
110
|
+
v.name
|
109
111
|
})
|
110
112
|
end
|
111
113
|
|
@@ -148,7 +150,7 @@ module Nuva
|
|
148
150
|
end
|
149
151
|
end
|
150
152
|
|
151
|
-
class
|
153
|
+
class LookupGeneralizedVaccines
|
152
154
|
def initialize(repositories, valencesByVaccine)
|
153
155
|
@vaccines = repositories.vaccines
|
154
156
|
@valences = repositories.valences
|
@@ -158,56 +160,28 @@ module Nuva
|
|
158
160
|
def call(vaccine)
|
159
161
|
targetValences = @valencesByVaccine.(vaccine)
|
160
162
|
list = @vaccines.all.filter do |candidate|
|
161
|
-
candidate.id
|
162
|
-
|
163
|
-
|
163
|
+
next if candidate.id == vaccine.id || !candidate.generic
|
164
|
+
|
165
|
+
@valencesByVaccine.(candidate).all? do |candidateValence|
|
166
|
+
targetValences.any? do |targetValence|
|
167
|
+
parent_of?(candidateValence, targetValence)
|
164
168
|
end
|
165
169
|
end
|
166
170
|
end
|
167
|
-
list.sort_by do |v|
|
171
|
+
list.sort_by do |v| -@valencesByVaccine.(v).length end
|
168
172
|
end
|
169
173
|
|
170
174
|
private def child_of?(valence, parent)
|
171
|
-
|
175
|
+
until valence.nil?
|
172
176
|
return true if valence.id == parent.id
|
173
|
-
valence = @valences.find
|
177
|
+
valence = @valences.find(valence.parent_id)
|
174
178
|
end
|
175
179
|
|
176
180
|
false
|
177
181
|
end
|
178
|
-
end
|
179
|
-
|
180
182
|
|
181
|
-
|
182
|
-
|
183
|
-
@vaccines = repositories.vaccines
|
184
|
-
@valences = repositories.valences
|
185
|
-
@valencesByVaccine = valencesByVaccine
|
186
|
-
end
|
187
|
-
|
188
|
-
def call(vaccine)
|
189
|
-
targetValences = @valencesByVaccine.(vaccine)
|
190
|
-
list = @vaccines.all.filter do |candidate|
|
191
|
-
candidate.id != vaccine.id && targetValences.all? do |targetValence|
|
192
|
-
@valencesByVaccine.(candidate).any? do |candidateValence|
|
193
|
-
child_of? candidateValence, targetValence
|
194
|
-
end
|
195
|
-
end
|
196
|
-
end
|
197
|
-
list.sort_by do |v| @valencesByVaccine.(v).length end
|
198
|
-
end
|
199
|
-
|
200
|
-
private def parent_of?(valence, parent)
|
201
|
-
child_of? parent, valence
|
202
|
-
end
|
203
|
-
|
204
|
-
private def child_of?(valence, parent)
|
205
|
-
unless valence.nil?
|
206
|
-
return true if valence.id == parent.id
|
207
|
-
valence = @valences.find valence.parent_id
|
208
|
-
end
|
209
|
-
|
210
|
-
false
|
183
|
+
def parent_of?(parent, child)
|
184
|
+
child_of?(child, parent)
|
211
185
|
end
|
212
186
|
end
|
213
187
|
|
@@ -228,7 +202,7 @@ module Nuva
|
|
228
202
|
@vaccines = repositories.vaccines
|
229
203
|
end
|
230
204
|
|
231
|
-
def call
|
205
|
+
def call
|
232
206
|
@vaccines
|
233
207
|
.all
|
234
208
|
.flat_map(&:codes)
|
data/lib/nuva/version.rb
ADDED
data/lib/nuva.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require_relative '
|
4
|
-
require_relative '
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'nuva/version'
|
4
|
+
require_relative 'nuva/NuvaDatabase_pb'
|
5
|
+
require_relative 'nuva/repository'
|
6
|
+
require_relative 'nuva/queries'
|
5
7
|
require 'net/http'
|
6
8
|
require 'json'
|
7
9
|
require 'ostruct'
|
@@ -30,18 +32,21 @@ module Nuva
|
|
30
32
|
@queries.vaccine_fuzzy_search = ::Nuva::Queries::VaccineFuzzySearch.new @repositories
|
31
33
|
@queries.lookup_vaccine_by_code = ::Nuva::Queries::LookupVaccineByCode.new @repositories
|
32
34
|
@queries.lookup_equivalent_vaccines = ::Nuva::Queries::LookupEquivalentVaccines.new @repositories
|
33
|
-
@queries.lookup_specialized_vaccines = ::Nuva::Queries::LookupSpecializedVaccines.new @repositories, @queries.valences_by_vaccine
|
34
35
|
@queries.lookup_generalized_vaccines = ::Nuva::Queries::LookupGeneralizedVaccines.new @repositories, @queries.valences_by_vaccine
|
35
36
|
@queries.all_nomenclatures = ::Nuva::Queries::AllNomenclatures.new @repositories
|
36
37
|
@queries.all_code_by_nomenclature = ::Nuva::Queries::AllCodeByNomenclature.new @repositories
|
37
38
|
@queries.freeze
|
38
39
|
end
|
39
40
|
|
41
|
+
def version
|
42
|
+
@db.version
|
43
|
+
end
|
44
|
+
|
40
45
|
def self.load(lang = "en")
|
41
46
|
latest_version_uri = URI "https://cdnnuva.mesvaccins.net/versions/last.json"
|
42
47
|
|
43
48
|
::Net::HTTP.start(latest_version_uri.host, latest_version_uri.port,
|
44
|
-
:
|
49
|
+
use_ssl: latest_version_uri.scheme == 'https') do |http|
|
45
50
|
|
46
51
|
# Fetch version manifest
|
47
52
|
req = ::Net::HTTP::Get.new latest_version_uri
|
@@ -49,7 +54,7 @@ module Nuva
|
|
49
54
|
res = http.request req
|
50
55
|
res.value
|
51
56
|
|
52
|
-
manifest = JSON
|
57
|
+
manifest = JSON.parse(res.body)
|
53
58
|
|
54
59
|
dump_hash = manifest['dump_hash']
|
55
60
|
|
data/nuva.gemspec
CHANGED
@@ -1,16 +1,37 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
3
|
+
require_relative "lib/nuva/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "nuva"
|
7
|
+
spec.version = Nuva::VERSION
|
8
|
+
spec.authors = ["Syadem"]
|
9
|
+
spec.email = ["developers@mesvaccins.net"]
|
10
|
+
|
11
|
+
spec.summary = "NUVA"
|
12
|
+
spec.description = "nuva library aims to simplify working and interacting with the NUVA nomenclature through queries and repositories."
|
13
|
+
spec.homepage = "https://docs.nuva.mesvaccins.net"
|
14
|
+
spec.required_ruby_version = ">= 3.0.0"
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
# spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
18
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(__dir__) do
|
23
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
24
|
+
(File.expand_path(f) == __FILE__) ||
|
25
|
+
f.start_with?(*%w[bin/ test/ spec/ features/ .git .gitlab-ci.yml appveyor Gemfile])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_dependency 'google-protobuf', '~> 3.25', '>= 3.25.5'
|
33
|
+
spec.add_dependency 'fuzzy_match', '~> 2.1'
|
34
|
+
|
35
|
+
# For more information and examples about making a new gem, check out our
|
36
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
16
37
|
end
|
data/sig/nuva.rbs
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nuva
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Syadem
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '3.25'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 3.25.
|
22
|
+
version: 3.25.5
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '3.25'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.25.
|
32
|
+
version: 3.25.5
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: fuzzy_match
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,31 +45,37 @@ dependencies:
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '2.1'
|
47
47
|
description: nuva library aims to simplify working and interacting with the NUVA nomenclature
|
48
|
-
through queries and repositories
|
49
|
-
email:
|
48
|
+
through queries and repositories.
|
49
|
+
email:
|
50
|
+
- developers@mesvaccins.net
|
50
51
|
executables: []
|
51
52
|
extensions: []
|
52
53
|
extra_rdoc_files: []
|
53
54
|
files:
|
54
|
-
- "
|
55
|
-
- "
|
56
|
-
-
|
57
|
-
-
|
58
|
-
-
|
59
|
-
-
|
60
|
-
-
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
-
|
55
|
+
- ".rspec"
|
56
|
+
- ".rubocop.yml"
|
57
|
+
- Rakefile
|
58
|
+
- gen_proto.sh
|
59
|
+
- lib/nuva.rb
|
60
|
+
- lib/nuva/Code_pb.rb
|
61
|
+
- lib/nuva/Disease_pb.rb
|
62
|
+
- lib/nuva/InjectionMethod_pb.rb
|
63
|
+
- lib/nuva/NuvaDatabase_pb.rb
|
64
|
+
- lib/nuva/Vaccine_pb.rb
|
65
|
+
- lib/nuva/Valence_pb.rb
|
66
|
+
- lib/nuva/VersionInfo_pb.rb
|
67
|
+
- lib/nuva/queries.rb
|
68
|
+
- lib/nuva/repositories/disease_repository.rb
|
69
|
+
- lib/nuva/repositories/vaccine_repository.rb
|
70
|
+
- lib/nuva/repositories/valence_repository.rb
|
71
|
+
- lib/nuva/repository.rb
|
72
|
+
- lib/nuva/version.rb
|
68
73
|
- nuva.gemspec
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
metadata:
|
74
|
+
- sig/nuva.rbs
|
75
|
+
homepage: https://docs.nuva.mesvaccins.net
|
76
|
+
licenses: []
|
77
|
+
metadata:
|
78
|
+
homepage_uri: https://docs.nuva.mesvaccins.net
|
73
79
|
post_install_message:
|
74
80
|
rdoc_options: []
|
75
81
|
require_paths:
|
@@ -78,7 +84,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
84
|
requirements:
|
79
85
|
- - ">="
|
80
86
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
87
|
+
version: 3.0.0
|
82
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
89
|
requirements:
|
84
90
|
- - ">="
|
data/lib/version.rb
DELETED