vaccination-characteristics 1.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c38f62b61bcd209e389453c7835926eace661af1e2a6ec97c50761bfb8391297
4
+ data.tar.gz: bba32f9610de849d410311718572ebbbc2c2423e5a30390b1e7cf057b4ff605f
5
+ SHA512:
6
+ metadata.gz: b959888a5f91356ccba2a76359a259da3183c99d9889a823f8342bd8ee6fcad0c79ade3554ae6de0300e9cd33c4b12416b21988501d65ab73a6d72c31d691ba4
7
+ data.tar.gz: ef7322478000fec287cfe18d14a38a828400de431d5b070d705816e2b3441ee1934d2dbadad67dde580fd596d07a6e0e93d58cb630522fb6c6b8e30eaad263ec
data/Changelog.md ADDED
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-09-18
9
+
10
+ ### Changed
11
+
12
+ - Rename the gem and public API to Vaccination Characteristics.
13
+ - Rename the Protobuf package and root database message.
14
+
15
+ ## [0.2.0] - 2025-01-21
16
+
17
+ ### Added
18
+
19
+ - Add new methods `VaccinationCharacteristics::Database.load` and `VaccinationCharacteristics::Database.fetch_latest_version_hash`
20
+ - Implement `VaccinationCharacteristics::Database#inspect`
@@ -0,0 +1,13 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: ConditionType.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+
7
+ descriptor_data = "\n\x13ConditionType.proto\x12\evaccination_characteristics*>\n\rConditionType\x12\v\n\aBOOLEAN\x10\x00\x12\b\n\x04DATE\x10\x01\x12\t\n\x05FLOAT\x10\x02\x12\v\n\aINTEGER\x10\x03B\x13\n\x0Fcom.syadem.sadvP\x01b\x06proto3"
8
+
9
+ ::Google::Protobuf::DescriptorPool.generated_pool.add_serialized_file(descriptor_data)
10
+
11
+ module VaccinationCharacteristics
12
+ ConditionType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("vaccination_characteristics.ConditionType").enummodule
13
+ end
@@ -0,0 +1,14 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: Condition.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require_relative 'ConditionType_pb'
7
+ descriptor_data = "\n\x0FCondition.proto\x12\evaccination_characteristics\x1A\x13ConditionType.proto\">\n\x04Code\x12\"\n\fnomenclature\x18\x01 \x01(\tR\fnomenclature\x12\x12\n\x04code\x18\x02 \x01(\tR\x04code\"\xE0\x01\n\tCondition\x12\x0E\n\x02id\x18\x01 \x01(\x05R\x02id\x12\x14\n\x05label\x18\x02 \x01(\tR\x05label\x12 \n\vdescription\x18\x03 \x01(\tR\vdescription\x12>\n\x04type\x18\x04 \x01(\x0E2*.vaccination_characteristics.ConditionTypeR\x04type\x12\x12\n\x04tags\x18\x05 \x03(\tR\x04tags\x127\n\x05codes\x18\x06 \x03(\v2!.vaccination_characteristics.CodeR\x05codesB\x13\n\x0Fcom.syadem.sadvP\x01b\x06proto3"
8
+
9
+ ::Google::Protobuf::DescriptorPool.generated_pool.add_serialized_file(descriptor_data)
10
+
11
+ module VaccinationCharacteristics
12
+ Code = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("vaccination_characteristics.Code").msgclass
13
+ Condition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("vaccination_characteristics.Condition").msgclass
14
+ end
@@ -0,0 +1,15 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: VaccinationCharacteristicsDatabase.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/protobuf/timestamp_pb'
7
+ require_relative 'Version_pb'
8
+ require_relative 'Condition_pb'
9
+ descriptor_data = "\n(VaccinationCharacteristicsDatabase.proto\x12\evaccination_characteristics\x1A\x1Fgoogle/protobuf/timestamp.proto\x1A\rVersion.proto\x1A\x0FCondition.proto\"\x83\x02\n\"VaccinationCharacteristicsDatabase\x12>\n\aversion\x18\x01 \x01(\v2$.vaccination_characteristics.VersionR\aversion\x12=\n\fgenerated_at\x18\x02 \x01(\v2\x1A.google.protobuf.TimestampR\vgeneratedAt\x12\x16\n\x06locale\x18\x03 \x01(\tR\x06locale\x12F\n\nconditions\x18\x04 \x03(\v2&.vaccination_characteristics.ConditionR\nconditionsB\x13\n\x0Fcom.syadem.sadvP\x01b\x06proto3"
10
+
11
+ ::Google::Protobuf::DescriptorPool.generated_pool.add_serialized_file(descriptor_data)
12
+
13
+ module VaccinationCharacteristics
14
+ VaccinationCharacteristicsDatabase = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("vaccination_characteristics.VaccinationCharacteristicsDatabase").msgclass
15
+ end
@@ -0,0 +1,13 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: Version.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+
7
+ descriptor_data = "\n\rVersion.proto\x12\evaccination_characteristics\"K\n\aVersion\x12\x14\n\x05major\x18\x01 \x01(\rR\x05major\x12\x14\n\x05minor\x18\x02 \x01(\rR\x05minor\x12\x14\n\x05patch\x18\x03 \x01(\rR\x05patchB\x13\n\x0Fcom.syadem.sadvP\x01b\x06proto3"
8
+
9
+ ::Google::Protobuf::DescriptorPool.generated_pool.add_serialized_file(descriptor_data)
10
+
11
+ module VaccinationCharacteristics
12
+ Version = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("vaccination_characteristics.Version").msgclass
13
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VaccinationCharacteristics
4
+ module Repositories
5
+ class ConditionRepository < Repository
6
+ protected
7
+
8
+ def index_keys(item)
9
+ code_keys = item.codes.filter_map do |entry|
10
+ entry.code if entry.nomenclature == "SYADEM"
11
+ end
12
+
13
+ [item.id, *code_keys]
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VaccinationCharacteristics
4
+ class Repository
5
+ attr_reader :all
6
+
7
+ def initialize(data)
8
+ @all = data
9
+ @index = {}
10
+ data.each do |item|
11
+ index_keys(item).each do |key|
12
+ @index[normalize_key(key)] = item
13
+ end
14
+ end
15
+ end
16
+
17
+ def find(id)
18
+ @index[normalize_key(id)]
19
+ end
20
+
21
+ def by_ids(ids)
22
+ ids.map { |x| find x }.compact
23
+ end
24
+
25
+ def inspect
26
+ "#<#{self.class} count=#{all.count}>"
27
+ end
28
+
29
+ protected
30
+
31
+ def index_keys(item)
32
+ [item.id]
33
+ end
34
+
35
+ def normalize_key(key)
36
+ key.to_s
37
+ end
38
+ end
39
+ end
40
+
41
+ require_relative "repositories/condition_repository"
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VaccinationCharacteristics
4
+ VERSION = "1.0.0"
5
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "vaccination_characteristics/version"
4
+ require_relative "vaccination_characteristics/VaccinationCharacteristicsDatabase_pb"
5
+ require_relative "vaccination_characteristics/repository"
6
+ require "net/http"
7
+ require "json"
8
+ require "ostruct"
9
+
10
+ module VaccinationCharacteristics
11
+ class Database
12
+ attr_reader :repositories
13
+ attr_reader :queries
14
+
15
+ def initialize(db)
16
+ @db = db
17
+
18
+ @repositories = OpenStruct.new
19
+ @repositories.conditions =
20
+ Repositories::ConditionRepository.new db.conditions
21
+ @repositories.freeze
22
+ end
23
+
24
+ def version
25
+ @db.version
26
+ end
27
+
28
+ def inspect
29
+ "#<VaccinationCharacteristics::Database version=#{version.major}.#{version.minor}.#{version.patch} condition_count=#{repositories.conditions.all.count}>"
30
+ end
31
+
32
+ def generated_at
33
+ @db.generated_at
34
+ end
35
+
36
+ class << self
37
+ DEFAULT_CDN_URI = URI("https://vrc.cdn.mesvaccins.net")
38
+
39
+ def load(cdn_uri: DEFAULT_CDN_URI, lang: "en", hash: nil)
40
+ init_http(cdn_uri) do |http|
41
+ # Fetch version manifest if necessary
42
+ hash ||= fetch_latest_version_hash(http:)
43
+
44
+ response = http.get("/dumps/#{hash}_#{lang}.db")
45
+ Database.new(::VaccinationCharacteristics::VaccinationCharacteristicsDatabase.decode(response.body))
46
+ end
47
+ end
48
+
49
+ def fetch_latest_version_hash(cdn_uri: DEFAULT_CDN_URI, http: nil)
50
+ passed_http = !http.nil?
51
+ http = init_http(cdn_uri) if http.nil?
52
+ response = http.get("/versions/latest.json")
53
+ hash = JSON.parse(response.body)["hash"]
54
+
55
+ http.finish unless passed_http
56
+
57
+ hash
58
+ end
59
+
60
+ def load_from_file(path)
61
+ Database.new(::VaccinationCharacteristics::VaccinationCharacteristicsDatabase.decode(File.read(path)))
62
+ end
63
+
64
+ private
65
+
66
+ def init_http(cdn_uri, &block)
67
+ Net::HTTP.start(
68
+ cdn_uri.host,
69
+ cdn_uri.port,
70
+ use_ssl: cdn_uri.scheme == "https",
71
+ &block
72
+ )
73
+ end
74
+ end
75
+ end
76
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vaccination-characteristics
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Syadem
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2026-09-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: google-protobuf
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.35.1
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 4.35.1
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5'
33
+ - !ruby/object:Gem::Dependency
34
+ name: ostruct
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ description: Ruby SDK for the Syadem vaccination characteristics database
48
+ email:
49
+ - developers@mesvaccins.net
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - Changelog.md
55
+ - lib/vaccination_characteristics.rb
56
+ - lib/vaccination_characteristics/ConditionType_pb.rb
57
+ - lib/vaccination_characteristics/Condition_pb.rb
58
+ - lib/vaccination_characteristics/VaccinationCharacteristicsDatabase_pb.rb
59
+ - lib/vaccination_characteristics/Version_pb.rb
60
+ - lib/vaccination_characteristics/repositories/condition_repository.rb
61
+ - lib/vaccination_characteristics/repository.rb
62
+ - lib/vaccination_characteristics/version.rb
63
+ homepage: https://docs.nuva.mesvaccins.net
64
+ licenses:
65
+ - MIT
66
+ metadata:
67
+ homepage_uri: https://docs.nuva.mesvaccins.net
68
+ source_code_uri: https://github.com/Syadem/vaccination-characteristics
69
+ changelog_uri: https://github.com/Syadem/vaccination-characteristics/blob/main/ruby/Changelog.md
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 3.0.0
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubygems_version: 3.5.22
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: Vaccination characteristics for SADV
89
+ test_files: []