nuva 0.5.3 → 0.7.1
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 +4 -4
- data/Changelog.md +17 -0
- data/lib/nuva/Code_pb.rb +6 -8
- data/lib/nuva/Disease_pb.rb +6 -15
- data/lib/nuva/InjectionMethod_pb.rb +6 -12
- data/lib/nuva/NuvaDatabase_pb.rb +6 -12
- data/lib/nuva/Vaccine_pb.rb +6 -19
- data/lib/nuva/Valence_pb.rb +6 -17
- data/lib/nuva/VersionInfo_pb.rb +6 -9
- data/lib/nuva/version.rb +1 -1
- data/lib/nuva/version_watcher.rb +53 -0
- data/lib/nuva.rb +35 -43
- data/nuva.gemspec +2 -1
- metadata +26 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3ee207a48f475b7d608be8c0e044e83b304841c18bb480d7b76ee9fbf234a547
|
|
4
|
+
data.tar.gz: 489b90f689fc66608cb7c48372898bb4e8d778c0d7d8a81999100ed9f4080c0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a527ae401a066a78deb7d7c1b55caec65376506ab9004f871c06c4b8252a519805e757cc8f1e1db5a11c4ae844d4850723721f9c53d2b6cdc26013bb31e44b82
|
|
7
|
+
data.tar.gz: b14d72734d86b26a1ec5a8b91af6ac5bd54ff5bb45a59535b4ff715983f0245cd14041370cda4f606d06e7d42c65608cbfe6cbca2c525531fc3c71009317c1f5
|
data/Changelog.md
CHANGED
|
@@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.7.0] - 2026-11-18
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Add `Nuva::Nuva.watch_latest_version`, which polls the CDN version manifest and calls `on_update` with the new dump hash when a new version is published. Failures are reported to the optional `on_error` callback and the update is retried on the next poll.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- `Nuva::Nuva.load` no longer closes its HTTP connection before downloading the dump.
|
|
17
|
+
- Declare the `ostruct` dependency, no longer a default gem since Ruby 4.0.
|
|
18
|
+
|
|
19
|
+
## [0.6.0] - 2026-09-18
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Require `google-protobuf` version 4.35.1 or newer, while remaining below version 5.
|
|
24
|
+
|
|
8
25
|
## [0.5.3] - 2026-02-23
|
|
9
26
|
|
|
10
27
|
### Changed
|
data/lib/nuva/Code_pb.rb
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
3
|
# source: Code.proto
|
|
3
4
|
|
|
4
5
|
require 'google/protobuf'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
7
|
+
|
|
8
|
+
descriptor_data = "\n\nCode.proto\x12\x04nuva\"+\n\x04\x43ode\x12\x14\n\x0cnomenclature\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\tB!\n\x0f\x63om.syadem.nuvaP\x01\xaa\x02\x0bSyadem.Nuvab\x06proto3"
|
|
9
|
+
|
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
11
|
+
pool.add_serialized_file(descriptor_data)
|
|
14
12
|
|
|
15
13
|
module Nuva
|
|
16
14
|
Code = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("nuva.Code").msgclass
|
data/lib/nuva/Disease_pb.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
3
|
# source: Disease.proto
|
|
3
4
|
|
|
@@ -6,21 +7,11 @@ require 'google/protobuf'
|
|
|
6
7
|
require 'google/protobuf/timestamp_pb'
|
|
7
8
|
require_relative 'Code_pb'
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
optional :code, :uint32, 3
|
|
15
|
-
repeated :codes, :message, 4, "nuva.Code"
|
|
16
|
-
optional :vaccinable, :bool, 5
|
|
17
|
-
optional :screenable, :bool, 6
|
|
18
|
-
repeated :valence_ids, :string, 7
|
|
19
|
-
optional :created_at, :message, 16, "google.protobuf.Timestamp"
|
|
20
|
-
optional :updated_at, :message, 17, "google.protobuf.Timestamp"
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
10
|
+
|
|
11
|
+
descriptor_data = "\n\rDisease.proto\x12\x04nuva\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\nCode.proto\"\xe9\x01\n\x07\x44isease\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0c\n\x04\x63ode\x18\x03 \x01(\r\x12\x19\n\x05\x63odes\x18\x04 \x03(\x0b\x32\n.nuva.Code\x12\x12\n\nvaccinable\x18\x05 \x01(\x08\x12\x12\n\nscreenable\x18\x06 \x01(\x08\x12\x13\n\x0bvalence_ids\x18\x07 \x03(\t\x12.\n\ncreated_at\x18\x10 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\nupdated_at\x18\x11 \x01(\x0b\x32\x1a.google.protobuf.TimestampB!\n\x0f\x63om.syadem.nuvaP\x01\xaa\x02\x0bSyadem.Nuvab\x06proto3"
|
|
12
|
+
|
|
13
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
14
|
+
pool.add_serialized_file(descriptor_data)
|
|
24
15
|
|
|
25
16
|
module Nuva
|
|
26
17
|
Disease = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("nuva.Disease").msgclass
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
3
|
# source: InjectionMethod.proto
|
|
3
4
|
|
|
4
5
|
require 'google/protobuf'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
value :Subcutaneous, 2
|
|
12
|
-
value :Oral, 3
|
|
13
|
-
value :Intranasal, 4
|
|
14
|
-
value :Intradermal, 5
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
7
|
+
|
|
8
|
+
descriptor_data = "\n\x15InjectionMethod.proto\x12\x04nuva*\x81\x01\n\x0fInjectionMethod\x12\x1e\n\x1aUnspecifiedInjectionMethod\x10\x00\x12\x11\n\rIntramuscular\x10\x01\x12\x10\n\x0cSubcutaneous\x10\x02\x12\x08\n\x04Oral\x10\x03\x12\x0e\n\nIntranasal\x10\x04\x12\x0f\n\x0bIntradermal\x10\x05\x42!\n\x0f\x63om.syadem.nuvaP\x01\xaa\x02\x0bSyadem.Nuvab\x06proto3"
|
|
9
|
+
|
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
11
|
+
pool.add_serialized_file(descriptor_data)
|
|
18
12
|
|
|
19
13
|
module Nuva
|
|
20
14
|
InjectionMethod = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("nuva.InjectionMethod").enummodule
|
data/lib/nuva/NuvaDatabase_pb.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
3
|
# source: NuvaDatabase.proto
|
|
3
4
|
|
|
@@ -9,18 +10,11 @@ require_relative 'Vaccine_pb'
|
|
|
9
10
|
require_relative 'Disease_pb'
|
|
10
11
|
require_relative 'Valence_pb'
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
optional :locale, :string, 3
|
|
18
|
-
repeated :vaccines, :message, 4, "nuva.Vaccine"
|
|
19
|
-
repeated :diseases, :message, 5, "nuva.Disease"
|
|
20
|
-
repeated :valences, :message, 6, "nuva.Valence"
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
13
|
+
|
|
14
|
+
descriptor_data = "\n\x12NuvaDatabase.proto\x12\x04nuva\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x11VersionInfo.proto\x1a\rVaccine.proto\x1a\rDisease.proto\x1a\rValence.proto\"\xd7\x01\n\x0cNuvaDatabase\x12\"\n\x07version\x18\x01 \x01(\x0b\x32\x11.nuva.VersionInfo\x12\x30\n\x0cgenerated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0e\n\x06locale\x18\x03 \x01(\t\x12\x1f\n\x08vaccines\x18\x04 \x03(\x0b\x32\r.nuva.Vaccine\x12\x1f\n\x08\x64iseases\x18\x05 \x03(\x0b\x32\r.nuva.Disease\x12\x1f\n\x08valences\x18\x06 \x03(\x0b\x32\r.nuva.ValenceB!\n\x0f\x63om.syadem.nuvaP\x01\xaa\x02\x0bSyadem.Nuvab\x06proto3"
|
|
15
|
+
|
|
16
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
17
|
+
pool.add_serialized_file(descriptor_data)
|
|
24
18
|
|
|
25
19
|
module Nuva
|
|
26
20
|
NuvaDatabase = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("nuva.NuvaDatabase").msgclass
|
data/lib/nuva/Vaccine_pb.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
3
|
# source: Vaccine.proto
|
|
3
4
|
|
|
@@ -7,25 +8,11 @@ require 'google/protobuf/timestamp_pb'
|
|
|
7
8
|
require_relative 'InjectionMethod_pb'
|
|
8
9
|
require_relative 'Code_pb'
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
optional :short_description, :string, 3
|
|
16
|
-
optional :description, :string, 4
|
|
17
|
-
repeated :injection_methods, :enum, 5, "nuva.InjectionMethod"
|
|
18
|
-
optional :code, :uint32, 6
|
|
19
|
-
repeated :codes, :message, 7, "nuva.Code"
|
|
20
|
-
repeated :valence_ids, :string, 8
|
|
21
|
-
repeated :other_names, :string, 9
|
|
22
|
-
optional :generic, :bool, 10
|
|
23
|
-
optional :replaced_by_id, :string, 11
|
|
24
|
-
optional :created_at, :message, 16, "google.protobuf.Timestamp"
|
|
25
|
-
optional :updated_at, :message, 17, "google.protobuf.Timestamp"
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
11
|
+
|
|
12
|
+
descriptor_data = "\n\rVaccine.proto\x12\x04nuva\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x15InjectionMethod.proto\x1a\nCode.proto\"\xe1\x02\n\x07Vaccine\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x19\n\x11short_description\x18\x03 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x04 \x01(\t\x12\x30\n\x11injection_methods\x18\x05 \x03(\x0e\x32\x15.nuva.InjectionMethod\x12\x0c\n\x04\x63ode\x18\x06 \x01(\r\x12\x19\n\x05\x63odes\x18\x07 \x03(\x0b\x32\n.nuva.Code\x12\x13\n\x0bvalence_ids\x18\x08 \x03(\t\x12\x13\n\x0bother_names\x18\t \x03(\t\x12\x0f\n\x07generic\x18\n \x01(\x08\x12\x16\n\x0ereplaced_by_id\x18\x0b \x01(\t\x12.\n\ncreated_at\x18\x10 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\nupdated_at\x18\x11 \x01(\x0b\x32\x1a.google.protobuf.TimestampB!\n\x0f\x63om.syadem.nuvaP\x01\xaa\x02\x0bSyadem.Nuvab\x06proto3"
|
|
13
|
+
|
|
14
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
15
|
+
pool.add_serialized_file(descriptor_data)
|
|
29
16
|
|
|
30
17
|
module Nuva
|
|
31
18
|
Vaccine = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("nuva.Vaccine").msgclass
|
data/lib/nuva/Valence_pb.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
3
|
# source: Valence.proto
|
|
3
4
|
|
|
@@ -5,23 +6,11 @@ require 'google/protobuf'
|
|
|
5
6
|
|
|
6
7
|
require 'google/protobuf/timestamp_pb'
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
optional :code, :uint32, 3
|
|
14
|
-
optional :name, :string, 4
|
|
15
|
-
optional :abbreviation, :string, 5
|
|
16
|
-
optional :translated_abbreviation, :string, 6
|
|
17
|
-
repeated :disease_ids, :string, 7
|
|
18
|
-
repeated :vaccine_ids, :string, 8
|
|
19
|
-
optional :antigene_type, :string, 9
|
|
20
|
-
optional :created_at, :message, 16, "google.protobuf.Timestamp"
|
|
21
|
-
optional :updated_at, :message, 17, "google.protobuf.Timestamp"
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
9
|
+
|
|
10
|
+
descriptor_data = "\n\rValence.proto\x12\x04nuva\x1a\x1fgoogle/protobuf/timestamp.proto\"\x9c\x02\n\x07Valence\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\tparent_id\x18\x02 \x01(\t\x12\x0c\n\x04\x63ode\x18\x03 \x01(\r\x12\x0c\n\x04name\x18\x04 \x01(\t\x12\x14\n\x0c\x61\x62\x62reviation\x18\x05 \x01(\t\x12\x1f\n\x17translated_abbreviation\x18\x06 \x01(\t\x12\x13\n\x0b\x64isease_ids\x18\x07 \x03(\t\x12\x13\n\x0bvaccine_ids\x18\x08 \x03(\t\x12\x15\n\rantigene_type\x18\t \x01(\t\x12.\n\ncreated_at\x18\x10 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\nupdated_at\x18\x11 \x01(\x0b\x32\x1a.google.protobuf.TimestampB!\n\x0f\x63om.syadem.nuvaP\x01\xaa\x02\x0bSyadem.Nuvab\x06proto3"
|
|
11
|
+
|
|
12
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
13
|
+
pool.add_serialized_file(descriptor_data)
|
|
25
14
|
|
|
26
15
|
module Nuva
|
|
27
16
|
Valence = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("nuva.Valence").msgclass
|
data/lib/nuva/VersionInfo_pb.rb
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
3
|
# source: VersionInfo.proto
|
|
3
4
|
|
|
4
5
|
require 'google/protobuf'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
optional :patch, :uint32, 3
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
7
|
+
|
|
8
|
+
descriptor_data = "\n\x11VersionInfo.proto\x12\x04nuva\":\n\x0bVersionInfo\x12\r\n\x05major\x18\x01 \x01(\r\x12\r\n\x05minor\x18\x02 \x01(\r\x12\r\n\x05patch\x18\x03 \x01(\rB!\n\x0f\x63om.syadem.nuvaP\x01\xaa\x02\x0bSyadem.Nuvab\x06proto3"
|
|
9
|
+
|
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
11
|
+
pool.add_serialized_file(descriptor_data)
|
|
15
12
|
|
|
16
13
|
module Nuva
|
|
17
14
|
VersionInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("nuva.VersionInfo").msgclass
|
data/lib/nuva/version.rb
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nuva
|
|
4
|
+
class VersionWatcher
|
|
5
|
+
attr_reader :current_version_hash
|
|
6
|
+
|
|
7
|
+
def initialize(fetch_latest_version_hash:, polling_interval:, on_update:, on_error: nil)
|
|
8
|
+
raise ArgumentError, "polling_interval must be positive" unless polling_interval.positive?
|
|
9
|
+
raise ArgumentError, "on_update must respond to #call" unless on_update.respond_to?(:call)
|
|
10
|
+
raise ArgumentError, "on_error must respond to #call" unless on_error.nil? || on_error.respond_to?(:call)
|
|
11
|
+
|
|
12
|
+
@fetch_latest_version_hash = fetch_latest_version_hash
|
|
13
|
+
@polling_interval = polling_interval
|
|
14
|
+
@on_update = on_update
|
|
15
|
+
@on_error = on_error
|
|
16
|
+
@current_version_hash = @fetch_latest_version_hash.call
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def start
|
|
20
|
+
@thread = Thread.new do
|
|
21
|
+
loop do
|
|
22
|
+
sleep(@polling_interval)
|
|
23
|
+
check_for_update
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
self
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def stop
|
|
31
|
+
@thread&.kill
|
|
32
|
+
@thread&.join
|
|
33
|
+
|
|
34
|
+
self
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def check_for_update
|
|
38
|
+
latest_version_hash = @fetch_latest_version_hash.call
|
|
39
|
+
|
|
40
|
+
return if latest_version_hash == @current_version_hash
|
|
41
|
+
|
|
42
|
+
@on_update.call(latest_version_hash)
|
|
43
|
+
|
|
44
|
+
@current_version_hash = latest_version_hash
|
|
45
|
+
rescue StandardError => e
|
|
46
|
+
@on_error&.call(e)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def running?
|
|
50
|
+
@thread&.alive? || false
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
data/lib/nuva.rb
CHANGED
|
@@ -4,6 +4,7 @@ require_relative "nuva/version"
|
|
|
4
4
|
require_relative "nuva/NuvaDatabase_pb"
|
|
5
5
|
require_relative "nuva/repository"
|
|
6
6
|
require_relative "nuva/queries"
|
|
7
|
+
require_relative "nuva/version_watcher"
|
|
7
8
|
require "net/http"
|
|
8
9
|
require "json"
|
|
9
10
|
require "ostruct"
|
|
@@ -14,40 +15,28 @@ module Nuva
|
|
|
14
15
|
attr_reader :queries
|
|
15
16
|
|
|
16
17
|
def initialize(db)
|
|
17
|
-
@db
|
|
18
|
-
|
|
18
|
+
@db = db
|
|
19
19
|
@repositories = OpenStruct.new
|
|
20
|
-
@
|
|
21
|
-
|
|
22
|
-
@repositories.
|
|
23
|
-
@repositories.
|
|
20
|
+
@queries = OpenStruct.new
|
|
21
|
+
|
|
22
|
+
@repositories.vaccines = VaccineRepository.new(db.vaccines)
|
|
23
|
+
@repositories.valences = ValenceRepository.new(db.valences)
|
|
24
|
+
@repositories.diseases = DiseaseRepository.new(db.diseases)
|
|
24
25
|
|
|
25
|
-
@queries
|
|
26
|
-
@queries.
|
|
27
|
-
|
|
28
|
-
@queries.
|
|
29
|
-
|
|
30
|
-
@queries.
|
|
31
|
-
::Nuva::Queries::
|
|
32
|
-
@queries.
|
|
33
|
-
|
|
34
|
-
@queries.
|
|
35
|
-
|
|
36
|
-
@queries.
|
|
37
|
-
|
|
38
|
-
@
|
|
39
|
-
::Nuva::Queries::VaccineFuzzySearchQuery.new @repositories
|
|
40
|
-
@queries.lookup_vaccine_by_code =
|
|
41
|
-
::Nuva::Queries::LookupVaccineByCodeQuery.new @repositories
|
|
42
|
-
@queries.lookup_equivalent_vaccines =
|
|
43
|
-
::Nuva::Queries::LookupEquivalentVaccinesQuery.new @repositories
|
|
44
|
-
@queries.lookup_generalized_vaccines =
|
|
45
|
-
::Nuva::Queries::LookupGeneralizedVaccinesQuery.new @repositories,
|
|
46
|
-
@queries.valences_by_vaccine
|
|
47
|
-
@queries.all_nomenclatures =
|
|
48
|
-
::Nuva::Queries::AllNomenclaturesQuery.new @repositories
|
|
49
|
-
@queries.all_code_by_nomenclature =
|
|
50
|
-
::Nuva::Queries::AllCodeByNomenclatureQuery.new @repositories
|
|
26
|
+
@queries.valences_by_vaccine = ::Nuva::Queries::ValencesByVaccineQuery.new(@repositories)
|
|
27
|
+
@queries.vaccines_by_valence = ::Nuva::Queries::VaccinesByValenceQuery.new(@repositories)
|
|
28
|
+
@queries.vaccines_by_disease = ::Nuva::Queries::VaccinesByDiseaseQuery.new(@repositories)
|
|
29
|
+
@queries.valences_by_disease = ::Nuva::Queries::ValencesByDiseaseQuery.new(@repositories)
|
|
30
|
+
@queries.diseases_by_vaccine = ::Nuva::Queries::DiseasesByVaccineQuery.new(@repositories)
|
|
31
|
+
@queries.diseases_by_valence = ::Nuva::Queries::DiseasesByValenceQuery.new(@repositories)
|
|
32
|
+
@queries.vaccine_fuzzy_search = ::Nuva::Queries::VaccineFuzzySearchQuery.new(@repositories)
|
|
33
|
+
@queries.lookup_vaccine_by_code = ::Nuva::Queries::LookupVaccineByCodeQuery.new(@repositories)
|
|
34
|
+
@queries.lookup_equivalent_vaccines = ::Nuva::Queries::LookupEquivalentVaccinesQuery.new(@repositories)
|
|
35
|
+
@queries.lookup_generalized_vaccines = ::Nuva::Queries::LookupGeneralizedVaccinesQuery.new(@repositories, @queries.valences_by_vaccine)
|
|
36
|
+
@queries.all_nomenclatures = ::Nuva::Queries::AllNomenclaturesQuery.new(@repositories)
|
|
37
|
+
@queries.all_code_by_nomenclature = ::Nuva::Queries::AllCodeByNomenclatureQuery.new(@repositories)
|
|
38
|
+
|
|
39
|
+
@repositories.freeze
|
|
51
40
|
@queries.freeze
|
|
52
41
|
end
|
|
53
42
|
|
|
@@ -64,23 +53,26 @@ module Nuva
|
|
|
64
53
|
|
|
65
54
|
def load(cdn_uri: DEFAULT_CDN_URI, lang: "en", hash: nil, proxy_addr: nil, proxy_port: nil)
|
|
66
55
|
init_http(cdn_uri, proxy_addr, proxy_port) do |http|
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
hash ||= fetch_latest_version_hash(http:)
|
|
57
|
+
response = http.get("/proto/#{hash}_#{lang}.db")
|
|
69
58
|
|
|
70
|
-
response = http.get("/proto/#{hash}_#{lang}.db")
|
|
71
59
|
::Nuva::Nuva.new(::Nuva::NuvaDatabase.decode(response.body))
|
|
72
60
|
end
|
|
73
61
|
end
|
|
74
62
|
|
|
75
63
|
def fetch_latest_version_hash(cdn_uri: DEFAULT_CDN_URI, proxy_addr: nil, proxy_port: nil, http: nil)
|
|
76
|
-
if http.nil?
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
64
|
+
return init_http(cdn_uri, proxy_addr, proxy_port) { |h| fetch_latest_version_hash(http: h) } if http.nil?
|
|
65
|
+
|
|
66
|
+
JSON.parse(http.get("/versions/last.json").body)["dump_hash"]
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def watch_latest_version(cdn_uri: DEFAULT_CDN_URI, polling_interval: 60, on_update:, on_error: nil, proxy_addr: nil, proxy_port: nil)
|
|
70
|
+
VersionWatcher.new(
|
|
71
|
+
fetch_latest_version_hash: -> { fetch_latest_version_hash(cdn_uri:, proxy_addr:, proxy_port:) },
|
|
72
|
+
polling_interval:,
|
|
73
|
+
on_update:,
|
|
74
|
+
on_error:
|
|
75
|
+
).start
|
|
84
76
|
end
|
|
85
77
|
|
|
86
78
|
def load_from_file(path)
|
data/nuva.gemspec
CHANGED
|
@@ -29,8 +29,9 @@ Gem::Specification.new do |spec|
|
|
|
29
29
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
30
30
|
spec.require_paths = ["lib"]
|
|
31
31
|
|
|
32
|
-
spec.add_dependency 'google-protobuf', '
|
|
32
|
+
spec.add_dependency 'google-protobuf', '>= 4.35.1', '< 5'
|
|
33
33
|
spec.add_dependency 'fuzzy_match', '~> 2.1'
|
|
34
|
+
spec.add_dependency 'ostruct'
|
|
34
35
|
|
|
35
36
|
# For more information and examples about making a new gem, check out our
|
|
36
37
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nuva
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Syadem
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: google-protobuf
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '3.25'
|
|
20
17
|
- - ">="
|
|
21
18
|
- !ruby/object:Gem::Version
|
|
22
|
-
version:
|
|
19
|
+
version: 4.35.1
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '5'
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
26
|
requirements:
|
|
27
|
-
- - "~>"
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
version: '3.25'
|
|
30
27
|
- - ">="
|
|
31
28
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
29
|
+
version: 4.35.1
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '5'
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: fuzzy_match
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -44,6 +44,20 @@ dependencies:
|
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
46
|
version: '2.1'
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: ostruct
|
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
type: :runtime
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
47
61
|
description: nuva library aims to simplify working and interacting with the NUVA nomenclature
|
|
48
62
|
through queries and repositories.
|
|
49
63
|
email:
|
|
@@ -72,6 +86,7 @@ files:
|
|
|
72
86
|
- lib/nuva/repositories/valence_repository.rb
|
|
73
87
|
- lib/nuva/repository.rb
|
|
74
88
|
- lib/nuva/version.rb
|
|
89
|
+
- lib/nuva/version_watcher.rb
|
|
75
90
|
- nuva.gemspec
|
|
76
91
|
- sig/nuva.rbs
|
|
77
92
|
homepage: https://docs.nuva.mesvaccins.net
|
|
@@ -93,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
93
108
|
- !ruby/object:Gem::Version
|
|
94
109
|
version: '0'
|
|
95
110
|
requirements: []
|
|
96
|
-
rubygems_version: 3.5.
|
|
111
|
+
rubygems_version: 3.5.22
|
|
97
112
|
signing_key:
|
|
98
113
|
specification_version: 4
|
|
99
114
|
summary: NUVA
|