nuva 0.1.7 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42d68d0dbbdfc96e269f94cc15383d7117613c807d4f7b73e108972c50a8dad2
4
- data.tar.gz: c19f6dfecda00b7219a5f87b7b7bc6824dfa1d512ee4c2d3759c4020761c4df4
3
+ metadata.gz: 391786d07b2a721da8b3c80f24937cd69c62221c0e67f0eaa2803ecbb243fe54
4
+ data.tar.gz: 5e31145383cf0e4c70686d2f65121401f49465a4c72ca18f6cb2291085fdbd0e
5
5
  SHA512:
6
- metadata.gz: f75fbf53fb2eb1ee61ea47d504ab0b302b0544a40f2893b01a50d3acfde1a01bd2f5ddd14330e4572bfe96073ece9fc2e55924a2bd7295322906c8cec7079f6a
7
- data.tar.gz: 22175c5e8695d51530003a58644fca0f4ead3b638b420bf2bee3dea6bfeff999aff9caaba2d780e8ceaf5cbfe7937aa7b1c2632e9b4a472b93e61d1bce5a3373
6
+ metadata.gz: f387e49eb07942ba3192aa92a34632662bc9fcf6ffaae18c5ea85225ea8a7c897f345fb3112c5c0c4795f4a8be540a4d7e49a7490abffd4ba19ce6ed09f5e860
7
+ data.tar.gz: 26e0ba31d8834da784eae5da7915360caf1bc26f134c19875ddaef477fb7131b12e53b9547e8bb4daca21ca330d7ba315c833b1c26e08695ebe6ba76b24670c9
@@ -0,0 +1,25 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/templates/tree/main/src/ruby
3
+ {
4
+ "name": "nuva-ruby",
5
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6
+ "image": "mcr.microsoft.com/devcontainers/ruby:1-3.3-bullseye",
7
+ "features": {
8
+ "ghcr.io/devcontainers/features/common-utils:2": {}
9
+ }
10
+
11
+ // Features to add to the dev container. More info: https://containers.dev/features.
12
+ // "features": {},
13
+
14
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
15
+ // "forwardPorts": [],
16
+
17
+ // Use 'postCreateCommand' to run commands after the container is created.
18
+ // "postCreateCommand": "ruby --version",
19
+
20
+ // Configure tool-specific properties.
21
+ // "customizations": {},
22
+
23
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
24
+ // "remoteUser": "root"
25
+ }
data/Changelog.md ADDED
@@ -0,0 +1,13 @@
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
+ ## [0.2.0] - 2025-01-17
9
+
10
+ ### Added
11
+
12
+ - Support finding entities (vaccines, diseases, valences) by numeric code (not just uuid)
13
+ - Add changelog file
data/lib/nuva/Code_pb.rb CHANGED
@@ -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 => :proto2) do
7
+ add_file("Code.proto", :syntax => :proto3) do
8
8
  add_message "nuva.Code" do
9
- required :nomenclature, :string, 1
10
- required :value, :string, 2
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 => :proto2) do
10
+ add_file("Disease.proto", :syntax => :proto3) do
11
11
  add_message "nuva.Disease" do
12
- required :id, :string, 1
13
- required :name, :string, 2
14
- required :code, :uint32, 3
12
+ optional :id, :string, 1
13
+ optional :name, :string, 2
14
+ optional :code, :uint32, 3
15
15
  repeated :codes, :message, 4, "nuva.Code"
16
- required :vaccinable, :bool, 5
17
- required :screenable, :bool, 6
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 => :proto2) do
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 => :proto2) do
13
+ add_file("NuvaDatabase.proto", :syntax => :proto3) do
14
14
  add_message "nuva.NuvaDatabase" do
15
- required :version, :message, 1, "nuva.VersionInfo"
16
- required :generated_at, :message, 2, "google.protobuf.Timestamp"
17
- required :locale, :string, 3
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 => :proto2) do
11
+ add_file("Vaccine.proto", :syntax => :proto3) do
12
12
  add_message "nuva.Vaccine" do
13
- required :id, :string, 1
14
- required :name, :string, 2
15
- required :short_description, :string, 3
16
- required :description, :string, 4
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
- required :code, :uint32, 6
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
- required :generic, :bool, 10
22
+ optional :generic, :bool, 10
23
23
  optional :replaced_by_id, :string, 11
24
- required :created_at, :message, 16, "google.protobuf.Timestamp"
25
- required :updated_at, :message, 17, "google.protobuf.Timestamp"
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 => :proto2) do
9
+ add_file("Valence.proto", :syntax => :proto3) do
10
10
  add_message "nuva.Valence" do
11
- required :id, :string, 1
12
- required :parent_id, :string, 2
13
- required :code, :uint32, 3
14
- required :name, :string, 4
15
- required :abbreviation, :string, 5
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
- required :created_at, :message, 16, "google.protobuf.Timestamp"
21
- required :updated_at, :message, 17, "google.protobuf.Timestamp"
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 => :proto2) do
7
+ add_file("VersionInfo.proto", :syntax => :proto3) do
8
8
  add_message "nuva.VersionInfo" do
9
- required :major, :uint32, 1
10
- required :minor, :uint32, 2
11
- required :patch, :uint32, 3
9
+ optional :major, :uint32, 1
10
+ optional :minor, :uint32, 2
11
+ optional :patch, :uint32, 3
12
12
  end
13
13
  end
14
14
  end
@@ -6,10 +6,11 @@ module Nuva
6
6
 
7
7
  def initialize(data)
8
8
  @data = index_array_by_id(data)
9
+ @data_by_code = data.each_with_object({}) { |item, acc| acc[item.code] = item }
9
10
  end
10
11
 
11
- def find(id)
12
- @data[id]
12
+ def find(id_or_code)
13
+ @data_by_code[id_or_code] || @data[id_or_code]
13
14
  end
14
15
 
15
16
  def all
@@ -20,10 +21,6 @@ module Nuva
20
21
  ids.map { |x| find x }.compact
21
22
  end
22
23
 
23
- # def by_ids(ids)
24
- # @data.select { |k, _v| ids.include?(k) }.values
25
- # end
26
-
27
24
  private
28
25
 
29
26
  def index_array_by_id(array)
data/lib/nuva/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nuva
4
- VERSION = '0.1.7'
4
+ VERSION = "0.2.0"
5
5
  end
data/nuva.gemspec CHANGED
@@ -29,7 +29,7 @@ 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', '~> 3.25', '>= 3.25.3'
32
+ spec.add_dependency 'google-protobuf', '~> 3.25', '>= 3.25.5'
33
33
  spec.add_dependency 'fuzzy_match', '~> 2.1'
34
34
 
35
35
  # For more information and examples about making a new gem, check out our
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.7
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Syadem
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-27 00:00:00.000000000 Z
11
+ date: 2025-01-17 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.3
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.3
32
+ version: 3.25.5
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: fuzzy_match
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -52,8 +52,10 @@ executables: []
52
52
  extensions: []
53
53
  extra_rdoc_files: []
54
54
  files:
55
+ - ".devcontainer/devcontainer.json"
55
56
  - ".rspec"
56
57
  - ".rubocop.yml"
58
+ - Changelog.md
57
59
  - Rakefile
58
60
  - gen_proto.sh
59
61
  - lib/nuva.rb