pharmaobservatory 0.1.12 → 0.1.13

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.
@@ -0,0 +1,454 @@
1
+ =begin
2
+ #Pharma Observatory Public REST API
3
+
4
+ #Read-only REST API over the Pharma Observatory biomedical data platform. Reference: https://pharmaobservatory.com/api-reference
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.13.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PharmaObservatory
17
+ # One row of the company_peer_profile dataset: one row per industry company with at least one program row. A grouped request returns the group columns and the measures instead, as additional properties.
18
+ class CompanyPeerProfileRow
19
+ # Company level: the company the row is about; the entry key for the companies object type.
20
+ attr_accessor :company_id
21
+
22
+ # Display name of the company.
23
+ attr_accessor :company_name
24
+
25
+ # Group level: the company's current ultimate parent; a root's group is itself.
26
+ attr_accessor :group_id
27
+
28
+ # Display name of the group.
29
+ attr_accessor :group_name
30
+
31
+ # measured when the company has at least one peer; no_live_owned_program when it has no live owned program; phase_not_reported when its live owned programs carry no phase; no_candidates when stage and modality are known and no other company shares them.
32
+ attr_accessor :peer_state
33
+
34
+ # Distinct live owned (drug, condition) programs of the company's subtree.
35
+ attr_accessor :n_live_owned_programs
36
+
37
+ # Distinct live owned drugs of the company's subtree.
38
+ attr_accessor :n_live_owned_drugs
39
+
40
+ # Furthest phase of the live owned programs: approved, phase3, phase2 (Phase 2/3 included), phase1 (Phase 1/2 included) or early_phase1. Null when no program carries a phase.
41
+ attr_accessor :lead_stage
42
+
43
+ # The phase code behind lead_stage: 6 Phase 4 or approved, 5 Phase 3, 4 Phase 2/3, 3 Phase 2, 2 Phase 1/2, 1 Phase 1, 0 Early Phase 1.
44
+ attr_accessor :lead_max_phase
45
+
46
+ # The canonical drug id of the lead drug, the highest-phase live owned drug (ties: most trials, then drug id).
47
+ attr_accessor :lead_drug_id
48
+
49
+ # Name of the lead drug.
50
+ attr_accessor :lead_drug_name
51
+
52
+ # Live owned drugs whose GSRS substance type is protein or nucleic acid.
53
+ attr_accessor :n_biologic_drugs
54
+
55
+ # n_biologic_drugs over n_live_owned_drugs, 0 to 1. Null when the company has no live owned drug.
56
+ attr_accessor :biologic_share
57
+
58
+ # biologic when biologic_share is at least 0.5, else non_biologic.
59
+ attr_accessor :modality_band
60
+
61
+ # MeSH top-level category with the most live owned program trials.
62
+ attr_accessor :primary_area
63
+
64
+ # Live owned program trials in primary_area.
65
+ attr_accessor :primary_area_trials
66
+
67
+ # Distinct lead-sponsored trials of the company's subtree.
68
+ attr_accessor :num_lead_trials
69
+
70
+ # Band of num_lead_trials: 1-4, 5-19, 20-99 or 100+.
71
+ attr_accessor :size_band
72
+
73
+ # Other measured companies outside the company's group that share stage, modality, area and size (match level 1), before the top 10 are kept.
74
+ attr_accessor :n_cell_candidates
75
+
76
+ # Peer rows kept for the company, at most 10.
77
+ attr_accessor :n_peers
78
+
79
+ # Companies in this dataset with peer_state measured. The same value on every row.
80
+ attr_accessor :coverage_measured
81
+
82
+ # Companies in this dataset. The same value on every row.
83
+ attr_accessor :coverage_total
84
+
85
+ # Attribute mapping from ruby-style variable name to JSON key.
86
+ def self.attribute_map
87
+ {
88
+ :'company_id' => :'company_id',
89
+ :'company_name' => :'company_name',
90
+ :'group_id' => :'group_id',
91
+ :'group_name' => :'group_name',
92
+ :'peer_state' => :'peer_state',
93
+ :'n_live_owned_programs' => :'n_live_owned_programs',
94
+ :'n_live_owned_drugs' => :'n_live_owned_drugs',
95
+ :'lead_stage' => :'lead_stage',
96
+ :'lead_max_phase' => :'lead_max_phase',
97
+ :'lead_drug_id' => :'lead_drug_id',
98
+ :'lead_drug_name' => :'lead_drug_name',
99
+ :'n_biologic_drugs' => :'n_biologic_drugs',
100
+ :'biologic_share' => :'biologic_share',
101
+ :'modality_band' => :'modality_band',
102
+ :'primary_area' => :'primary_area',
103
+ :'primary_area_trials' => :'primary_area_trials',
104
+ :'num_lead_trials' => :'num_lead_trials',
105
+ :'size_band' => :'size_band',
106
+ :'n_cell_candidates' => :'n_cell_candidates',
107
+ :'n_peers' => :'n_peers',
108
+ :'coverage_measured' => :'coverage_measured',
109
+ :'coverage_total' => :'coverage_total'
110
+ }
111
+ end
112
+
113
+ # Returns attribute mapping this model knows about
114
+ def self.acceptable_attribute_map
115
+ attribute_map
116
+ end
117
+
118
+ # Returns all the JSON keys this model knows about
119
+ def self.acceptable_attributes
120
+ acceptable_attribute_map.values
121
+ end
122
+
123
+ # Attribute type mapping.
124
+ def self.openapi_types
125
+ {
126
+ :'company_id' => :'String',
127
+ :'company_name' => :'String',
128
+ :'group_id' => :'String',
129
+ :'group_name' => :'String',
130
+ :'peer_state' => :'String',
131
+ :'n_live_owned_programs' => :'Integer',
132
+ :'n_live_owned_drugs' => :'Integer',
133
+ :'lead_stage' => :'String',
134
+ :'lead_max_phase' => :'Integer',
135
+ :'lead_drug_id' => :'String',
136
+ :'lead_drug_name' => :'String',
137
+ :'n_biologic_drugs' => :'Integer',
138
+ :'biologic_share' => :'Float',
139
+ :'modality_band' => :'String',
140
+ :'primary_area' => :'String',
141
+ :'primary_area_trials' => :'Integer',
142
+ :'num_lead_trials' => :'Integer',
143
+ :'size_band' => :'String',
144
+ :'n_cell_candidates' => :'Integer',
145
+ :'n_peers' => :'Integer',
146
+ :'coverage_measured' => :'Integer',
147
+ :'coverage_total' => :'Integer'
148
+ }
149
+ end
150
+
151
+ # List of attributes with nullable: true
152
+ def self.openapi_nullable
153
+ Set.new([
154
+ :'company_id',
155
+ :'company_name',
156
+ :'group_id',
157
+ :'group_name',
158
+ :'peer_state',
159
+ :'n_live_owned_programs',
160
+ :'n_live_owned_drugs',
161
+ :'lead_stage',
162
+ :'lead_max_phase',
163
+ :'lead_drug_id',
164
+ :'lead_drug_name',
165
+ :'n_biologic_drugs',
166
+ :'biologic_share',
167
+ :'modality_band',
168
+ :'primary_area',
169
+ :'primary_area_trials',
170
+ :'num_lead_trials',
171
+ :'size_band',
172
+ :'n_cell_candidates',
173
+ :'n_peers',
174
+ :'coverage_measured',
175
+ :'coverage_total'
176
+ ])
177
+ end
178
+
179
+ # Initializes the object
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ def initialize(attributes = {})
182
+ if (!attributes.is_a?(Hash))
183
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PharmaObservatory::CompanyPeerProfileRow` initialize method"
184
+ end
185
+
186
+ # check to see if the attribute exists and convert string to symbol for hash key
187
+ acceptable_attribute_map = self.class.acceptable_attribute_map
188
+ attributes = attributes.each_with_object({}) { |(k, v), h|
189
+ if (!acceptable_attribute_map.key?(k.to_sym))
190
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PharmaObservatory::CompanyPeerProfileRow`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
191
+ end
192
+ h[k.to_sym] = v
193
+ }
194
+
195
+ if attributes.key?(:'company_id')
196
+ self.company_id = attributes[:'company_id']
197
+ end
198
+
199
+ if attributes.key?(:'company_name')
200
+ self.company_name = attributes[:'company_name']
201
+ end
202
+
203
+ if attributes.key?(:'group_id')
204
+ self.group_id = attributes[:'group_id']
205
+ end
206
+
207
+ if attributes.key?(:'group_name')
208
+ self.group_name = attributes[:'group_name']
209
+ end
210
+
211
+ if attributes.key?(:'peer_state')
212
+ self.peer_state = attributes[:'peer_state']
213
+ end
214
+
215
+ if attributes.key?(:'n_live_owned_programs')
216
+ self.n_live_owned_programs = attributes[:'n_live_owned_programs']
217
+ end
218
+
219
+ if attributes.key?(:'n_live_owned_drugs')
220
+ self.n_live_owned_drugs = attributes[:'n_live_owned_drugs']
221
+ end
222
+
223
+ if attributes.key?(:'lead_stage')
224
+ self.lead_stage = attributes[:'lead_stage']
225
+ end
226
+
227
+ if attributes.key?(:'lead_max_phase')
228
+ self.lead_max_phase = attributes[:'lead_max_phase']
229
+ end
230
+
231
+ if attributes.key?(:'lead_drug_id')
232
+ self.lead_drug_id = attributes[:'lead_drug_id']
233
+ end
234
+
235
+ if attributes.key?(:'lead_drug_name')
236
+ self.lead_drug_name = attributes[:'lead_drug_name']
237
+ end
238
+
239
+ if attributes.key?(:'n_biologic_drugs')
240
+ self.n_biologic_drugs = attributes[:'n_biologic_drugs']
241
+ end
242
+
243
+ if attributes.key?(:'biologic_share')
244
+ self.biologic_share = attributes[:'biologic_share']
245
+ end
246
+
247
+ if attributes.key?(:'modality_band')
248
+ self.modality_band = attributes[:'modality_band']
249
+ end
250
+
251
+ if attributes.key?(:'primary_area')
252
+ self.primary_area = attributes[:'primary_area']
253
+ end
254
+
255
+ if attributes.key?(:'primary_area_trials')
256
+ self.primary_area_trials = attributes[:'primary_area_trials']
257
+ end
258
+
259
+ if attributes.key?(:'num_lead_trials')
260
+ self.num_lead_trials = attributes[:'num_lead_trials']
261
+ end
262
+
263
+ if attributes.key?(:'size_band')
264
+ self.size_band = attributes[:'size_band']
265
+ end
266
+
267
+ if attributes.key?(:'n_cell_candidates')
268
+ self.n_cell_candidates = attributes[:'n_cell_candidates']
269
+ end
270
+
271
+ if attributes.key?(:'n_peers')
272
+ self.n_peers = attributes[:'n_peers']
273
+ end
274
+
275
+ if attributes.key?(:'coverage_measured')
276
+ self.coverage_measured = attributes[:'coverage_measured']
277
+ end
278
+
279
+ if attributes.key?(:'coverage_total')
280
+ self.coverage_total = attributes[:'coverage_total']
281
+ end
282
+ end
283
+
284
+ # Show invalid properties with the reasons. Usually used together with valid?
285
+ # @return Array for valid properties with the reasons
286
+ def list_invalid_properties
287
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
288
+ invalid_properties = Array.new
289
+ invalid_properties
290
+ end
291
+
292
+ # Check to see if the all the properties in the model are valid
293
+ # @return true if the model is valid
294
+ def valid?
295
+ warn '[DEPRECATED] the `valid?` method is obsolete'
296
+ true
297
+ end
298
+
299
+ # Checks equality by comparing each attribute.
300
+ # @param [Object] Object to be compared
301
+ def ==(o)
302
+ return true if self.equal?(o)
303
+ self.class == o.class &&
304
+ company_id == o.company_id &&
305
+ company_name == o.company_name &&
306
+ group_id == o.group_id &&
307
+ group_name == o.group_name &&
308
+ peer_state == o.peer_state &&
309
+ n_live_owned_programs == o.n_live_owned_programs &&
310
+ n_live_owned_drugs == o.n_live_owned_drugs &&
311
+ lead_stage == o.lead_stage &&
312
+ lead_max_phase == o.lead_max_phase &&
313
+ lead_drug_id == o.lead_drug_id &&
314
+ lead_drug_name == o.lead_drug_name &&
315
+ n_biologic_drugs == o.n_biologic_drugs &&
316
+ biologic_share == o.biologic_share &&
317
+ modality_band == o.modality_band &&
318
+ primary_area == o.primary_area &&
319
+ primary_area_trials == o.primary_area_trials &&
320
+ num_lead_trials == o.num_lead_trials &&
321
+ size_band == o.size_band &&
322
+ n_cell_candidates == o.n_cell_candidates &&
323
+ n_peers == o.n_peers &&
324
+ coverage_measured == o.coverage_measured &&
325
+ coverage_total == o.coverage_total
326
+ end
327
+
328
+ # @see the `==` method
329
+ # @param [Object] Object to be compared
330
+ def eql?(o)
331
+ self == o
332
+ end
333
+
334
+ # Calculates hash code according to all attributes.
335
+ # @return [Integer] Hash code
336
+ def hash
337
+ [company_id, company_name, group_id, group_name, peer_state, n_live_owned_programs, n_live_owned_drugs, lead_stage, lead_max_phase, lead_drug_id, lead_drug_name, n_biologic_drugs, biologic_share, modality_band, primary_area, primary_area_trials, num_lead_trials, size_band, n_cell_candidates, n_peers, coverage_measured, coverage_total].hash
338
+ end
339
+
340
+ # Builds the object from hash
341
+ # @param [Hash] attributes Model attributes in the form of hash
342
+ # @return [Object] Returns the model itself
343
+ def self.build_from_hash(attributes)
344
+ return nil unless attributes.is_a?(Hash)
345
+ attributes = attributes.transform_keys(&:to_sym)
346
+ transformed_hash = {}
347
+ openapi_types.each_pair do |key, type|
348
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
349
+ transformed_hash["#{key}"] = nil
350
+ elsif type =~ /\AArray<(.*)>/i
351
+ # check to ensure the input is an array given that the attribute
352
+ # is documented as an array but the input is not
353
+ if attributes[attribute_map[key]].is_a?(Array)
354
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
355
+ end
356
+ elsif !attributes[attribute_map[key]].nil?
357
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
358
+ end
359
+ end
360
+ new(transformed_hash)
361
+ end
362
+
363
+ # Deserializes the data based on type
364
+ # @param string type Data type
365
+ # @param string value Value to be deserialized
366
+ # @return [Object] Deserialized data
367
+ def self._deserialize(type, value)
368
+ case type.to_sym
369
+ when :Time
370
+ Time.parse(value)
371
+ when :Date
372
+ Date.parse(value)
373
+ when :String
374
+ value.to_s
375
+ when :Integer
376
+ value.to_i
377
+ when :Float
378
+ value.to_f
379
+ when :Boolean
380
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
381
+ true
382
+ else
383
+ false
384
+ end
385
+ when :Object
386
+ # generic object (usually a Hash), return directly
387
+ value
388
+ when /\AArray<(?<inner_type>.+)>\z/
389
+ inner_type = Regexp.last_match[:inner_type]
390
+ value.map { |v| _deserialize(inner_type, v) }
391
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
392
+ k_type = Regexp.last_match[:k_type]
393
+ v_type = Regexp.last_match[:v_type]
394
+ {}.tap do |hash|
395
+ value.each do |k, v|
396
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
397
+ end
398
+ end
399
+ else # model
400
+ # models (e.g. Pet) or oneOf
401
+ klass = PharmaObservatory.const_get(type)
402
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
403
+ end
404
+ end
405
+
406
+ # Returns the string representation of the object
407
+ # @return [String] String presentation of the object
408
+ def to_s
409
+ to_hash.to_s
410
+ end
411
+
412
+ # to_body is an alias to to_hash (backward compatibility)
413
+ # @return [Hash] Returns the object in the form of hash
414
+ def to_body
415
+ to_hash
416
+ end
417
+
418
+ # Returns the object in the form of hash
419
+ # @return [Hash] Returns the object in the form of hash
420
+ def to_hash
421
+ hash = {}
422
+ self.class.attribute_map.each_pair do |attr, param|
423
+ value = self.send(attr)
424
+ if value.nil?
425
+ is_nullable = self.class.openapi_nullable.include?(attr)
426
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
427
+ end
428
+
429
+ hash[param] = _to_hash(value)
430
+ end
431
+ hash
432
+ end
433
+
434
+ # Outputs non-array value in the form of hash
435
+ # For object, use to_hash. Otherwise, just return the value
436
+ # @param [Object] value Any valid value
437
+ # @return [Hash] Returns the value in the form of hash
438
+ def _to_hash(value)
439
+ if value.is_a?(Array)
440
+ value.compact.map { |v| _to_hash(v) }
441
+ elsif value.is_a?(Hash)
442
+ {}.tap do |hash|
443
+ value.each { |k, v| hash[k] = _to_hash(v) }
444
+ end
445
+ elsif value.respond_to? :to_hash
446
+ value.to_hash
447
+ else
448
+ value
449
+ end
450
+ end
451
+
452
+ end
453
+
454
+ end