pharmaobservatory 0.1.13 → 0.1.15
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/README.md +25 -5
- data/docs/BiomarkerValidationRow.md +1 -1
- data/docs/ChangesList200Response.md +26 -0
- data/docs/ChangesList200ResponseBuildState.md +20 -0
- data/docs/ChangesList200ResponseItemsInner.md +48 -0
- data/docs/ChangesList200ResponseItemsInnerEntryKeys.md +18 -0
- data/docs/CompaniesApi.md +86 -4
- data/docs/CompanyAssetCollisionsResponse.md +58 -0
- data/docs/CompanyAssetCollisionsRow.md +68 -0
- data/docs/CompanyCompetitorsRow.md +16 -32
- data/docs/CompanyFinancialsRow.md +18 -0
- data/docs/ConditionAdverseEventsRow.md +5 -1
- data/docs/SubscriptionsApi.md +282 -0
- data/docs/SubscriptionsCreate201Response.md +22 -0
- data/docs/SubscriptionsCreate201ResponseSubscription.md +28 -0
- data/docs/SubscriptionsCreate201ResponseSubscriptionTarget.md +22 -0
- data/docs/SubscriptionsCreateRequest.md +20 -0
- data/docs/SubscriptionsDelete200Response.md +24 -0
- data/docs/SubscriptionsList200Response.md +22 -0
- data/docs/SubscriptionsList200ResponseSubscriptionsInner.md +28 -0
- data/docs/SubscriptionsList200ResponseSubscriptionsInnerTarget.md +26 -0
- data/docs/SubscriptionsList200ResponseSubscriptionsInnerTargetFilters.md +18 -0
- data/lib/pharmaobservatory/api/companies_api.rb +93 -2
- data/lib/pharmaobservatory/api/subscriptions_api.rb +261 -0
- data/lib/pharmaobservatory/models/biomarker_validation_row.rb +1 -1
- data/lib/pharmaobservatory/models/changes_list200_response.rb +343 -0
- data/lib/pharmaobservatory/models/changes_list200_response_build_state.rb +263 -0
- data/lib/pharmaobservatory/models/changes_list200_response_items_inner.rb +627 -0
- data/lib/pharmaobservatory/models/changes_list200_response_items_inner_entry_keys.rb +237 -0
- data/lib/pharmaobservatory/models/company_asset_collisions_response.rb +478 -0
- data/lib/pharmaobservatory/models/company_asset_collisions_row.rb +502 -0
- data/lib/pharmaobservatory/models/company_competitors_row.rb +61 -153
- data/lib/pharmaobservatory/models/company_financials_row.rb +100 -1
- data/lib/pharmaobservatory/models/condition_adverse_events_row.rb +27 -5
- data/lib/pharmaobservatory/models/subscriptions_create201_response.rb +289 -0
- data/lib/pharmaobservatory/models/subscriptions_create201_response_subscription.rb +369 -0
- data/lib/pharmaobservatory/models/subscriptions_create201_response_subscription_target.rb +289 -0
- data/lib/pharmaobservatory/models/subscriptions_create_request.rb +263 -0
- data/lib/pharmaobservatory/models/subscriptions_delete200_response.rb +315 -0
- data/lib/pharmaobservatory/models/subscriptions_list200_response.rb +291 -0
- data/lib/pharmaobservatory/models/subscriptions_list200_response_subscriptions_inner.rb +369 -0
- data/lib/pharmaobservatory/models/subscriptions_list200_response_subscriptions_inner_target.rb +277 -0
- data/lib/pharmaobservatory/models/subscriptions_list200_response_subscriptions_inner_target_filters.rb +237 -0
- data/lib/pharmaobservatory/version.rb +1 -1
- data/lib/pharmaobservatory.rb +16 -0
- metadata +34 -2
|
@@ -0,0 +1,502 @@
|
|
|
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_asset_collisions dataset: one row per company asset, competitor asset and target family: a live, owned asset of the company and one of another company on a common target family. A grouped request returns the group columns and the measures instead, as additional properties.
|
|
18
|
+
class CompanyAssetCollisionsRow
|
|
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
|
+
# Molecule level: the company's asset, the resolved drug (a drug with two canonical ids is one asset).
|
|
32
|
+
attr_accessor :molecule_id
|
|
33
|
+
|
|
34
|
+
# The asset's display name, from the company's most-trialled record of it.
|
|
35
|
+
attr_accessor :molecule_name
|
|
36
|
+
|
|
37
|
+
# Company level: the company whose asset collides.
|
|
38
|
+
attr_accessor :competitor_company_id
|
|
39
|
+
|
|
40
|
+
# Display name of the competitor's company.
|
|
41
|
+
attr_accessor :competitor_company_name
|
|
42
|
+
|
|
43
|
+
# Group level: the competitor's current ultimate parent; a root's group is itself.
|
|
44
|
+
attr_accessor :competitor_group_id
|
|
45
|
+
|
|
46
|
+
# Display name of the competitor's group.
|
|
47
|
+
attr_accessor :competitor_group_name
|
|
48
|
+
|
|
49
|
+
# Molecule level: the competitor's asset, the resolved drug.
|
|
50
|
+
attr_accessor :competitor_molecule_id
|
|
51
|
+
|
|
52
|
+
# The competitor asset's display name.
|
|
53
|
+
attr_accessor :competitor_molecule_name
|
|
54
|
+
|
|
55
|
+
# The company drug's target family of the shared gene (the Open Targets target name, so a taxane's tubulin isotypes are one family; the ChEMBL mechanism text for a drug Open Targets lacks; the gene symbol for a curated investigational asset).
|
|
56
|
+
attr_accessor :target_family
|
|
57
|
+
|
|
58
|
+
# Gene symbols of the shared genes within the family.
|
|
59
|
+
attr_accessor :shared_symbols
|
|
60
|
+
|
|
61
|
+
# The company drug's action on the family (Open Targets or ChEMBL vocabulary); null when no source states one.
|
|
62
|
+
attr_accessor :action_type
|
|
63
|
+
|
|
64
|
+
# The competitor drug's action on the shared genes; null when no source states one.
|
|
65
|
+
attr_accessor :competitor_action_type
|
|
66
|
+
|
|
67
|
+
# True when the two drugs have the same action type on a shared gene of the family.
|
|
68
|
+
attr_accessor :same_action
|
|
69
|
+
|
|
70
|
+
# Disease areas both programs are in, among live programs.
|
|
71
|
+
attr_accessor :n_shared_indications
|
|
72
|
+
|
|
73
|
+
# Up to 3 shared disease area names, by the pair's combined trial count. An empty list when none.
|
|
74
|
+
attr_accessor :top_shared_indications
|
|
75
|
+
|
|
76
|
+
# The less advanced of the two programs' furthest phase: 6 Phase 4, 5 Phase 3, 4 Phase 2/3, 3 Phase 2, 2 Phase 1/2, 1 Phase 1, 0 Early Phase 1, -1 phase not applicable.
|
|
77
|
+
attr_accessor :stage
|
|
78
|
+
|
|
79
|
+
# The later of the two programs' last trial start year.
|
|
80
|
+
attr_accessor :last_year
|
|
81
|
+
|
|
82
|
+
# Trials led by either company in which one drug is experimental and the other an active comparator.
|
|
83
|
+
attr_accessor :n_head_to_head_trials
|
|
84
|
+
|
|
85
|
+
# Why the company owns the drug. experimental_arm and regulatory_holder rest on evidence; inferred_lead is an inference (no arm data says otherwise).
|
|
86
|
+
attr_accessor :ownership_basis
|
|
87
|
+
|
|
88
|
+
# Why the competitor owns its drug, same vocabulary as ownership_basis.
|
|
89
|
+
attr_accessor :competitor_ownership_basis
|
|
90
|
+
|
|
91
|
+
# The rarity weight of the family: the natural log of (companies holding any live, owned target family) over (companies holding this one).
|
|
92
|
+
attr_accessor :family_idf
|
|
93
|
+
|
|
94
|
+
# The weight of the pair, family_idf times a factor for same action, a shared indication, the stage, recency and a head-to-head trial.
|
|
95
|
+
attr_accessor :collision_weight
|
|
96
|
+
|
|
97
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
98
|
+
def self.attribute_map
|
|
99
|
+
{
|
|
100
|
+
:'company_id' => :'company_id',
|
|
101
|
+
:'company_name' => :'company_name',
|
|
102
|
+
:'group_id' => :'group_id',
|
|
103
|
+
:'group_name' => :'group_name',
|
|
104
|
+
:'molecule_id' => :'molecule_id',
|
|
105
|
+
:'molecule_name' => :'molecule_name',
|
|
106
|
+
:'competitor_company_id' => :'competitor_company_id',
|
|
107
|
+
:'competitor_company_name' => :'competitor_company_name',
|
|
108
|
+
:'competitor_group_id' => :'competitor_group_id',
|
|
109
|
+
:'competitor_group_name' => :'competitor_group_name',
|
|
110
|
+
:'competitor_molecule_id' => :'competitor_molecule_id',
|
|
111
|
+
:'competitor_molecule_name' => :'competitor_molecule_name',
|
|
112
|
+
:'target_family' => :'target_family',
|
|
113
|
+
:'shared_symbols' => :'shared_symbols',
|
|
114
|
+
:'action_type' => :'action_type',
|
|
115
|
+
:'competitor_action_type' => :'competitor_action_type',
|
|
116
|
+
:'same_action' => :'same_action',
|
|
117
|
+
:'n_shared_indications' => :'n_shared_indications',
|
|
118
|
+
:'top_shared_indications' => :'top_shared_indications',
|
|
119
|
+
:'stage' => :'stage',
|
|
120
|
+
:'last_year' => :'last_year',
|
|
121
|
+
:'n_head_to_head_trials' => :'n_head_to_head_trials',
|
|
122
|
+
:'ownership_basis' => :'ownership_basis',
|
|
123
|
+
:'competitor_ownership_basis' => :'competitor_ownership_basis',
|
|
124
|
+
:'family_idf' => :'family_idf',
|
|
125
|
+
:'collision_weight' => :'collision_weight'
|
|
126
|
+
}
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Returns attribute mapping this model knows about
|
|
130
|
+
def self.acceptable_attribute_map
|
|
131
|
+
attribute_map
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Returns all the JSON keys this model knows about
|
|
135
|
+
def self.acceptable_attributes
|
|
136
|
+
acceptable_attribute_map.values
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Attribute type mapping.
|
|
140
|
+
def self.openapi_types
|
|
141
|
+
{
|
|
142
|
+
:'company_id' => :'String',
|
|
143
|
+
:'company_name' => :'String',
|
|
144
|
+
:'group_id' => :'String',
|
|
145
|
+
:'group_name' => :'String',
|
|
146
|
+
:'molecule_id' => :'String',
|
|
147
|
+
:'molecule_name' => :'String',
|
|
148
|
+
:'competitor_company_id' => :'String',
|
|
149
|
+
:'competitor_company_name' => :'String',
|
|
150
|
+
:'competitor_group_id' => :'String',
|
|
151
|
+
:'competitor_group_name' => :'String',
|
|
152
|
+
:'competitor_molecule_id' => :'String',
|
|
153
|
+
:'competitor_molecule_name' => :'String',
|
|
154
|
+
:'target_family' => :'String',
|
|
155
|
+
:'shared_symbols' => :'Array<String>',
|
|
156
|
+
:'action_type' => :'String',
|
|
157
|
+
:'competitor_action_type' => :'String',
|
|
158
|
+
:'same_action' => :'Boolean',
|
|
159
|
+
:'n_shared_indications' => :'Integer',
|
|
160
|
+
:'top_shared_indications' => :'Array<String>',
|
|
161
|
+
:'stage' => :'Integer',
|
|
162
|
+
:'last_year' => :'Integer',
|
|
163
|
+
:'n_head_to_head_trials' => :'Integer',
|
|
164
|
+
:'ownership_basis' => :'String',
|
|
165
|
+
:'competitor_ownership_basis' => :'String',
|
|
166
|
+
:'family_idf' => :'Float',
|
|
167
|
+
:'collision_weight' => :'Float'
|
|
168
|
+
}
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# List of attributes with nullable: true
|
|
172
|
+
def self.openapi_nullable
|
|
173
|
+
Set.new([
|
|
174
|
+
:'company_id',
|
|
175
|
+
:'company_name',
|
|
176
|
+
:'group_id',
|
|
177
|
+
:'group_name',
|
|
178
|
+
:'molecule_id',
|
|
179
|
+
:'molecule_name',
|
|
180
|
+
:'competitor_company_id',
|
|
181
|
+
:'competitor_company_name',
|
|
182
|
+
:'competitor_group_id',
|
|
183
|
+
:'competitor_group_name',
|
|
184
|
+
:'competitor_molecule_id',
|
|
185
|
+
:'competitor_molecule_name',
|
|
186
|
+
:'target_family',
|
|
187
|
+
:'shared_symbols',
|
|
188
|
+
:'action_type',
|
|
189
|
+
:'competitor_action_type',
|
|
190
|
+
:'same_action',
|
|
191
|
+
:'n_shared_indications',
|
|
192
|
+
:'top_shared_indications',
|
|
193
|
+
:'stage',
|
|
194
|
+
:'last_year',
|
|
195
|
+
:'n_head_to_head_trials',
|
|
196
|
+
:'ownership_basis',
|
|
197
|
+
:'competitor_ownership_basis',
|
|
198
|
+
:'family_idf',
|
|
199
|
+
:'collision_weight'
|
|
200
|
+
])
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# Initializes the object
|
|
204
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
205
|
+
def initialize(attributes = {})
|
|
206
|
+
if (!attributes.is_a?(Hash))
|
|
207
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PharmaObservatory::CompanyAssetCollisionsRow` initialize method"
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
211
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
212
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
213
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
214
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PharmaObservatory::CompanyAssetCollisionsRow`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
215
|
+
end
|
|
216
|
+
h[k.to_sym] = v
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if attributes.key?(:'company_id')
|
|
220
|
+
self.company_id = attributes[:'company_id']
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
if attributes.key?(:'company_name')
|
|
224
|
+
self.company_name = attributes[:'company_name']
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
if attributes.key?(:'group_id')
|
|
228
|
+
self.group_id = attributes[:'group_id']
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
if attributes.key?(:'group_name')
|
|
232
|
+
self.group_name = attributes[:'group_name']
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
if attributes.key?(:'molecule_id')
|
|
236
|
+
self.molecule_id = attributes[:'molecule_id']
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
if attributes.key?(:'molecule_name')
|
|
240
|
+
self.molecule_name = attributes[:'molecule_name']
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
if attributes.key?(:'competitor_company_id')
|
|
244
|
+
self.competitor_company_id = attributes[:'competitor_company_id']
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
if attributes.key?(:'competitor_company_name')
|
|
248
|
+
self.competitor_company_name = attributes[:'competitor_company_name']
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
if attributes.key?(:'competitor_group_id')
|
|
252
|
+
self.competitor_group_id = attributes[:'competitor_group_id']
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
if attributes.key?(:'competitor_group_name')
|
|
256
|
+
self.competitor_group_name = attributes[:'competitor_group_name']
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
if attributes.key?(:'competitor_molecule_id')
|
|
260
|
+
self.competitor_molecule_id = attributes[:'competitor_molecule_id']
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
if attributes.key?(:'competitor_molecule_name')
|
|
264
|
+
self.competitor_molecule_name = attributes[:'competitor_molecule_name']
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
if attributes.key?(:'target_family')
|
|
268
|
+
self.target_family = attributes[:'target_family']
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
if attributes.key?(:'shared_symbols')
|
|
272
|
+
if (value = attributes[:'shared_symbols']).is_a?(Array)
|
|
273
|
+
self.shared_symbols = value
|
|
274
|
+
end
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
if attributes.key?(:'action_type')
|
|
278
|
+
self.action_type = attributes[:'action_type']
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
if attributes.key?(:'competitor_action_type')
|
|
282
|
+
self.competitor_action_type = attributes[:'competitor_action_type']
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
if attributes.key?(:'same_action')
|
|
286
|
+
self.same_action = attributes[:'same_action']
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
if attributes.key?(:'n_shared_indications')
|
|
290
|
+
self.n_shared_indications = attributes[:'n_shared_indications']
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
if attributes.key?(:'top_shared_indications')
|
|
294
|
+
if (value = attributes[:'top_shared_indications']).is_a?(Array)
|
|
295
|
+
self.top_shared_indications = value
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
if attributes.key?(:'stage')
|
|
300
|
+
self.stage = attributes[:'stage']
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
if attributes.key?(:'last_year')
|
|
304
|
+
self.last_year = attributes[:'last_year']
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
if attributes.key?(:'n_head_to_head_trials')
|
|
308
|
+
self.n_head_to_head_trials = attributes[:'n_head_to_head_trials']
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
if attributes.key?(:'ownership_basis')
|
|
312
|
+
self.ownership_basis = attributes[:'ownership_basis']
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
if attributes.key?(:'competitor_ownership_basis')
|
|
316
|
+
self.competitor_ownership_basis = attributes[:'competitor_ownership_basis']
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
if attributes.key?(:'family_idf')
|
|
320
|
+
self.family_idf = attributes[:'family_idf']
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
if attributes.key?(:'collision_weight')
|
|
324
|
+
self.collision_weight = attributes[:'collision_weight']
|
|
325
|
+
end
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
329
|
+
# @return Array for valid properties with the reasons
|
|
330
|
+
def list_invalid_properties
|
|
331
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
332
|
+
invalid_properties = Array.new
|
|
333
|
+
invalid_properties
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
# Check to see if the all the properties in the model are valid
|
|
337
|
+
# @return true if the model is valid
|
|
338
|
+
def valid?
|
|
339
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
340
|
+
true
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
# Checks equality by comparing each attribute.
|
|
344
|
+
# @param [Object] Object to be compared
|
|
345
|
+
def ==(o)
|
|
346
|
+
return true if self.equal?(o)
|
|
347
|
+
self.class == o.class &&
|
|
348
|
+
company_id == o.company_id &&
|
|
349
|
+
company_name == o.company_name &&
|
|
350
|
+
group_id == o.group_id &&
|
|
351
|
+
group_name == o.group_name &&
|
|
352
|
+
molecule_id == o.molecule_id &&
|
|
353
|
+
molecule_name == o.molecule_name &&
|
|
354
|
+
competitor_company_id == o.competitor_company_id &&
|
|
355
|
+
competitor_company_name == o.competitor_company_name &&
|
|
356
|
+
competitor_group_id == o.competitor_group_id &&
|
|
357
|
+
competitor_group_name == o.competitor_group_name &&
|
|
358
|
+
competitor_molecule_id == o.competitor_molecule_id &&
|
|
359
|
+
competitor_molecule_name == o.competitor_molecule_name &&
|
|
360
|
+
target_family == o.target_family &&
|
|
361
|
+
shared_symbols == o.shared_symbols &&
|
|
362
|
+
action_type == o.action_type &&
|
|
363
|
+
competitor_action_type == o.competitor_action_type &&
|
|
364
|
+
same_action == o.same_action &&
|
|
365
|
+
n_shared_indications == o.n_shared_indications &&
|
|
366
|
+
top_shared_indications == o.top_shared_indications &&
|
|
367
|
+
stage == o.stage &&
|
|
368
|
+
last_year == o.last_year &&
|
|
369
|
+
n_head_to_head_trials == o.n_head_to_head_trials &&
|
|
370
|
+
ownership_basis == o.ownership_basis &&
|
|
371
|
+
competitor_ownership_basis == o.competitor_ownership_basis &&
|
|
372
|
+
family_idf == o.family_idf &&
|
|
373
|
+
collision_weight == o.collision_weight
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
# @see the `==` method
|
|
377
|
+
# @param [Object] Object to be compared
|
|
378
|
+
def eql?(o)
|
|
379
|
+
self == o
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
# Calculates hash code according to all attributes.
|
|
383
|
+
# @return [Integer] Hash code
|
|
384
|
+
def hash
|
|
385
|
+
[company_id, company_name, group_id, group_name, molecule_id, molecule_name, competitor_company_id, competitor_company_name, competitor_group_id, competitor_group_name, competitor_molecule_id, competitor_molecule_name, target_family, shared_symbols, action_type, competitor_action_type, same_action, n_shared_indications, top_shared_indications, stage, last_year, n_head_to_head_trials, ownership_basis, competitor_ownership_basis, family_idf, collision_weight].hash
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
# Builds the object from hash
|
|
389
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
390
|
+
# @return [Object] Returns the model itself
|
|
391
|
+
def self.build_from_hash(attributes)
|
|
392
|
+
return nil unless attributes.is_a?(Hash)
|
|
393
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
394
|
+
transformed_hash = {}
|
|
395
|
+
openapi_types.each_pair do |key, type|
|
|
396
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
397
|
+
transformed_hash["#{key}"] = nil
|
|
398
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
399
|
+
# check to ensure the input is an array given that the attribute
|
|
400
|
+
# is documented as an array but the input is not
|
|
401
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
402
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
403
|
+
end
|
|
404
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
405
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
406
|
+
end
|
|
407
|
+
end
|
|
408
|
+
new(transformed_hash)
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
# Deserializes the data based on type
|
|
412
|
+
# @param string type Data type
|
|
413
|
+
# @param string value Value to be deserialized
|
|
414
|
+
# @return [Object] Deserialized data
|
|
415
|
+
def self._deserialize(type, value)
|
|
416
|
+
case type.to_sym
|
|
417
|
+
when :Time
|
|
418
|
+
Time.parse(value)
|
|
419
|
+
when :Date
|
|
420
|
+
Date.parse(value)
|
|
421
|
+
when :String
|
|
422
|
+
value.to_s
|
|
423
|
+
when :Integer
|
|
424
|
+
value.to_i
|
|
425
|
+
when :Float
|
|
426
|
+
value.to_f
|
|
427
|
+
when :Boolean
|
|
428
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
429
|
+
true
|
|
430
|
+
else
|
|
431
|
+
false
|
|
432
|
+
end
|
|
433
|
+
when :Object
|
|
434
|
+
# generic object (usually a Hash), return directly
|
|
435
|
+
value
|
|
436
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
437
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
438
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
439
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
440
|
+
k_type = Regexp.last_match[:k_type]
|
|
441
|
+
v_type = Regexp.last_match[:v_type]
|
|
442
|
+
{}.tap do |hash|
|
|
443
|
+
value.each do |k, v|
|
|
444
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
445
|
+
end
|
|
446
|
+
end
|
|
447
|
+
else # model
|
|
448
|
+
# models (e.g. Pet) or oneOf
|
|
449
|
+
klass = PharmaObservatory.const_get(type)
|
|
450
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
451
|
+
end
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
# Returns the string representation of the object
|
|
455
|
+
# @return [String] String presentation of the object
|
|
456
|
+
def to_s
|
|
457
|
+
to_hash.to_s
|
|
458
|
+
end
|
|
459
|
+
|
|
460
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
461
|
+
# @return [Hash] Returns the object in the form of hash
|
|
462
|
+
def to_body
|
|
463
|
+
to_hash
|
|
464
|
+
end
|
|
465
|
+
|
|
466
|
+
# Returns the object in the form of hash
|
|
467
|
+
# @return [Hash] Returns the object in the form of hash
|
|
468
|
+
def to_hash
|
|
469
|
+
hash = {}
|
|
470
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
471
|
+
value = self.send(attr)
|
|
472
|
+
if value.nil?
|
|
473
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
474
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
hash[param] = _to_hash(value)
|
|
478
|
+
end
|
|
479
|
+
hash
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
# Outputs non-array value in the form of hash
|
|
483
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
484
|
+
# @param [Object] value Any valid value
|
|
485
|
+
# @return [Hash] Returns the value in the form of hash
|
|
486
|
+
def _to_hash(value)
|
|
487
|
+
if value.is_a?(Array)
|
|
488
|
+
value.compact.map { |v| _to_hash(v) }
|
|
489
|
+
elsif value.is_a?(Hash)
|
|
490
|
+
{}.tap do |hash|
|
|
491
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
492
|
+
end
|
|
493
|
+
elsif value.respond_to? :to_hash
|
|
494
|
+
value.to_hash
|
|
495
|
+
else
|
|
496
|
+
value
|
|
497
|
+
end
|
|
498
|
+
end
|
|
499
|
+
|
|
500
|
+
end
|
|
501
|
+
|
|
502
|
+
end
|