cosing 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4c1d24a9645d88deb596a2e1be49ed985f87ff340581bb80b105944a1b85683c
4
+ data.tar.gz: dc7ba8882733e0826751ba07ff486e06b5b153edbde606b2cf37558cb3e45e63
5
+ SHA512:
6
+ metadata.gz: ce698dfb511c4054ba58a7781ad0bd6d404b12d6006b58cfe3239386f4c279dde97db90dcf6012dec02a4b6f87b3b29d613d80656aa3180be2f3dc15c9c5ab9b
7
+ data.tar.gz: 913dc114a5948ece59fcb6dccdc4071d5ab59cd9a68d119f6d929d66c818e7031d3159af61cf71a385677374ef37a99a44a69173c9ea7a9ddd75b39186717255
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,6 @@
1
+ require:
2
+ - rubocop-inhouse
3
+
4
+ inherit_gem:
5
+ rubocop-inhouse:
6
+ - config/default.yml
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-12-03
4
+
5
+ - Initial release
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Nolan J Tait
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,152 @@
1
+ # Cosing
2
+
3
+ This is a gem to make the COSING database easier to work with.
4
+
5
+ Created by the team at [inhouse.work](https://www.inhouse.work)
6
+
7
+ ## Installation
8
+
9
+ Install the gem and add to the application's Gemfile by executing:
10
+
11
+ $ bundle add cosing
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ $ gem install cosing
16
+
17
+ ## Usage
18
+
19
+
20
+ ```ruby
21
+ database = Cosing.load
22
+ database.ingredients #=> Hash<ID, Ingredient>
23
+ database.ingredients.sample(2)
24
+ database.save("output.json", pretty: true) # Will save the whole database to a json file
25
+ ```
26
+
27
+ ```json
28
+ [
29
+ {
30
+ "reference_number":"90000",
31
+ "inci_name":"ECKLONIA CAVA WATER",
32
+ "inn":"",
33
+ "ph_eur_name":"",
34
+ "cas_numbers":[],
35
+ "einecs_numbers":[],
36
+ "description":"Ecklonia Cava Water is the aqueous solution of the steam distillates obtained from the whole plant, Ecklonia cava, Lessoniaceae.",
37
+ "restrictions":[],
38
+ "functions":["SKIN PROTECTING"],
39
+ "regulations":[]
40
+ },
41
+ {
42
+ "reference_number":"32549",
43
+ "inci_name":"CETEARTRIMONIUM CHLORIDE",
44
+ "inn":"",
45
+ "ph_eur_name":"",
46
+ "cas_numbers":["68002-62-0"],
47
+ "einecs_numbers":["268-075-4"],
48
+ "description":"Quaternary ammonium compounds, C16-18-alkyltrimethyl, chlorides",
49
+ "restrictions":["V/44"],
50
+ "functions":[
51
+ "ANTISTATIC",
52
+ "HAIR CONDITIONING",
53
+ "PRESERVATIVE"
54
+ ],
55
+ "regulations":[
56
+ {
57
+ "annex":"Cosing Annex V",
58
+ "cas_numbers":[
59
+ "17301-53-0",
60
+ "57-09-0",
61
+ "112-02-7",
62
+ "1119-94-4",
63
+ "112-00-5",
64
+ "1120-02-1",
65
+ "112-03-8"
66
+ ],
67
+ "chemical_name":"",
68
+ "cmr":"",
69
+ "ec_numbers":[
70
+ "241-327-0",
71
+ "200-311-3",
72
+ "203-928-6",
73
+ "214-290-3",
74
+ "203-927-0",
75
+ "214-294-5",
76
+ "203-929-1"
77
+ ],
78
+ "identified_ingredients":[
79
+ "BEHENTRIMONIUM CHLORIDE",
80
+ "CETEARTRIMONIUM CHLORIDE",
81
+ "CETRIMONIUM BROMIDE",
82
+ "CETRIMONIUM CHLORIDE",
83
+ "COCOTRIMONIUM CHLORIDE",
84
+ "HYDROGENATED PALMTRIMONIUM CHLORIDE",
85
+ "HYDROGENATED TALLOWTRIMONIUM CHLORIDE",
86
+ "LAURTRIMONIUM BROMIDE",
87
+ "LAURTRIMONIUM CHLORIDE",
88
+ "MYRTRIMONIUM BROMIDE",
89
+ "SOYTRIMONIUM CHLORIDE",
90
+ "STEARTRIMONIUM BROMIDE",
91
+ "STEARTRIMONIUM CHLORIDE",
92
+ "TALLOWTRIMONIUM CHLORIDE"
93
+ ],
94
+ "other_regulations":"",
95
+ "reference_number":"44",
96
+ "regulated_by":"91/184/EEC",
97
+ "regulation":"(EU) No 866/2014",
98
+ "sccs_opinions":[
99
+ {
100
+ "code":"0917/05",
101
+ "description":"Opinion on Alkyl (C16, C18, C22) trimethylammonium chloride - For other uses than as a preservative"
102
+ },
103
+ {
104
+ "code":"1087/07",
105
+ "description":"Opinion on Alkyl (C16, C18, C22) trimethylammonium chloride - For other uses than as a preservative"
106
+ },
107
+ {
108
+ "code":"1246/09",
109
+ "description":"Opinion on Alkyl (C16, C18, C22) trimethylammonium chloride - For other uses than as a preservative"
110
+ }
111
+ ],
112
+ "inn":"Alkyl (C12 -C22) trimethyl ammonium bromide and chloride",
113
+ "maximum_concentration":"0.1%",
114
+ "other_restrictions":"",
115
+ "product_type":"",
116
+ "wording_of_conditions":""
117
+ }
118
+ ]
119
+ }
120
+ ]
121
+ ```
122
+
123
+ ## Benchmarks
124
+
125
+ The library is fast to load on an SSD. You can run the benchmarks by running
126
+ `bin/benchmark`
127
+
128
+ ```
129
+ user system total real
130
+ Cosing.load 1.255882 0.048911 1.304793 ( 1.314068)
131
+ Cosing::Annex.load 0.127545 0.003247 0.130792 ( 0.131845)
132
+ ```
133
+
134
+ ## Development
135
+
136
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
137
+ `rake spec` to run the tests. You can also run `bin/console` for an interactive
138
+ prompt that will allow you to experiment.
139
+
140
+ To install this gem onto your local machine, run `bundle exec rake install`. To
141
+ release a new version, update the version number in `version.rb`, and then run
142
+ `bundle exec rake release`, which will create a git tag for the version, push
143
+ git commits and the created tag, and push the `.gem` file to
144
+ [rubygems.org](https://rubygems.org).
145
+
146
+ ## Contributing
147
+
148
+ Bug reports and pull requests are welcome on GitHub at https://github.com/inhouse/cosing.
149
+
150
+ ## License
151
+
152
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
9
+
10
+ desc "Output the cosing database into a json format"
11
+ task :export do
12
+ database = Cosing.load
13
+ database.save
14
+ end
data/cosing.gemspec ADDED
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/cosing/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "cosing"
7
+ spec.version = Cosing::VERSION
8
+ spec.authors = ["Nolan J Tait"]
9
+ spec.email = ["nolanjtait@gmail.com"]
10
+
11
+ spec.summary = "COSING database"
12
+ spec.description = spec.summary
13
+ spec.homepage = "https://github.com/inhouse-work/cosing"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 3"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata["changelog_uri"] = spec.homepage
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(__dir__) do
24
+ `git ls-files -z`.split("\x0").reject do |f|
25
+ (File.expand_path(f) == __FILE__) ||
26
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git appveyor Gemfile])
27
+ end
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ # Uncomment to register a new dependency of your gem
34
+ spec.add_dependency "dry-struct", "~> 1.6"
35
+ spec.add_dependency "dry-types", "~> 1.7"
36
+
37
+ # For more information and examples about making a new gem, check out our
38
+ # guide at: https://bundler.io/guides/creating_gem.html
39
+ spec.metadata["rubygems_mfa_required"] = "true"
40
+ end