pharmaobservatory 0.1.20 → 0.1.22

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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +40 -4
  3. data/docs/BiomarkersApi.md +160 -0
  4. data/docs/CompaniesApi.md +246 -0
  5. data/docs/HospitalsRow.md +11 -1
  6. data/docs/InvestmentGraphEdgesResponse.md +58 -0
  7. data/docs/InvestmentGraphEdgesRow.md +90 -0
  8. data/docs/InvestmentGraphNodeEdgesResponse.md +58 -0
  9. data/docs/InvestmentGraphNodeEdgesRow.md +88 -0
  10. data/docs/InvestmentGraphNodesResponse.md +58 -0
  11. data/docs/InvestmentGraphNodesRow.md +52 -0
  12. data/docs/InvestorsApi.md +240 -0
  13. data/docs/LegalEntitiesApi.md +240 -0
  14. data/docs/ProviderBiomarkerCapabilityResponse.md +58 -0
  15. data/docs/ProviderBiomarkerCapabilityRow.md +86 -0
  16. data/docs/ProviderBiomarkerCapabilitySummaryResponse.md +58 -0
  17. data/docs/ProviderBiomarkerCapabilitySummaryRow.md +70 -0
  18. data/docs/ProviderCliaLicensureResponse.md +58 -0
  19. data/docs/ProviderCliaLicensureRow.md +80 -0
  20. data/docs/ProviderRwdDeliveryResponse.md +58 -0
  21. data/docs/ProviderRwdDeliveryRow.md +74 -0
  22. data/docs/ProviderRwdDeliveryStudyResponse.md +58 -0
  23. data/docs/ProviderRwdDeliveryStudyRow.md +58 -0
  24. data/docs/ProviderRwdFootprintResponse.md +58 -0
  25. data/docs/ProviderRwdFootprintRow.md +72 -0
  26. data/docs/RwdInstitutionsApi.md +80 -0
  27. data/docs/SuppliersApi.md +480 -0
  28. data/lib/pharmaobservatory/api/biomarkers_api.rb +168 -0
  29. data/lib/pharmaobservatory/api/companies_api.rb +273 -0
  30. data/lib/pharmaobservatory/api/investors_api.rb +252 -0
  31. data/lib/pharmaobservatory/api/legal_entities_api.rb +252 -0
  32. data/lib/pharmaobservatory/api/rwd_institutions_api.rb +84 -0
  33. data/lib/pharmaobservatory/api/suppliers_api.rb +504 -0
  34. data/lib/pharmaobservatory/models/hospitals_row.rb +60 -5
  35. data/lib/pharmaobservatory/models/investment_graph_edges_response.rb +478 -0
  36. data/lib/pharmaobservatory/models/investment_graph_edges_row.rb +619 -0
  37. data/lib/pharmaobservatory/models/investment_graph_node_edges_response.rb +478 -0
  38. data/lib/pharmaobservatory/models/investment_graph_node_edges_row.rb +608 -0
  39. data/lib/pharmaobservatory/models/investment_graph_nodes_response.rb +478 -0
  40. data/lib/pharmaobservatory/models/investment_graph_nodes_row.rb +412 -0
  41. data/lib/pharmaobservatory/models/provider_biomarker_capability_response.rb +478 -0
  42. data/lib/pharmaobservatory/models/provider_biomarker_capability_row.rb +601 -0
  43. data/lib/pharmaobservatory/models/provider_biomarker_capability_summary_response.rb +478 -0
  44. data/lib/pharmaobservatory/models/provider_biomarker_capability_summary_row.rb +509 -0
  45. data/lib/pharmaobservatory/models/provider_clia_licensure_response.rb +478 -0
  46. data/lib/pharmaobservatory/models/provider_clia_licensure_row.rb +568 -0
  47. data/lib/pharmaobservatory/models/provider_rwd_delivery_response.rb +478 -0
  48. data/lib/pharmaobservatory/models/provider_rwd_delivery_row.rb +535 -0
  49. data/lib/pharmaobservatory/models/provider_rwd_delivery_study_response.rb +478 -0
  50. data/lib/pharmaobservatory/models/provider_rwd_delivery_study_row.rb +443 -0
  51. data/lib/pharmaobservatory/models/provider_rwd_footprint_response.rb +478 -0
  52. data/lib/pharmaobservatory/models/provider_rwd_footprint_row.rb +528 -0
  53. data/lib/pharmaobservatory/version.rb +1 -1
  54. data/lib/pharmaobservatory.rb +18 -0
  55. metadata +38 -2
@@ -0,0 +1,535 @@
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 provider_rwd_delivery dataset: one row per RX provider, register conductor name key and mandate stratum. A grouped request returns the group columns and the measures instead, as additional properties.
18
+ class ProviderRwdDeliveryRow
19
+ # The row id: a hash of provider_uuid, conductor_name_key and mandate_stratum.
20
+ attr_accessor :provider_rwd_delivery_id
21
+
22
+ # The supplier id: the Scientist.com provider id as text, the id in the supplier page address (/suppliers/<id>). The entry key of the suppliers object type. A supplier is not a company.
23
+ attr_accessor :provider_id
24
+
25
+ # The Scientist.com public provider uuid, the join key to the RX marketplace. Present on every row, including providers the marketplace does not publish.
26
+ attr_accessor :provider_uuid
27
+
28
+ # The supplier's marketplace slug.
29
+ attr_accessor :provider_slug
30
+
31
+ # The supplier's name.
32
+ attr_accessor :provider_name
33
+
34
+ # The register Institution ID of the winning route to the conductor (strongest method, then lowest id).
35
+ attr_accessor :institution_id
36
+
37
+ # match_method says how the provider was tied to the register institution: org_member_exact (through the supplier's resolved organization, match_confidence carried from that match), rx_name_key_exact (an exact match of the register institution's name key to the supplier's, match_confidence null, a name match and not a verified identity) or org_unit_of_entry (an organization unit of the supplier's organization, one-directional, match_confidence the bridge's own figure). Where a provider reaches one conductor by several routes the strongest wins, in that order, and match_methods lists every route.
38
+ attr_accessor :match_method
39
+
40
+ # The bridge's own confidence for the winning route, 0 to 1; null on an rx_name_key_exact row, whose exact name match defines none. Passed through, never computed here.
41
+ attr_accessor :match_confidence
42
+
43
+ # The normalised institution name key the conductor rollup is keyed on; every register institution whose name folds to it is one conductor. Not a vendor family.
44
+ attr_accessor :conductor_name_key
45
+
46
+ # Every register Institution ID that routes the provider to the conductor name key (more than one when the register lists the name twice or two methods reach it).
47
+ attr_accessor :matched_institution_ids
48
+
49
+ # Every match method that routes the provider to this conductor name key; match_method is the strongest of them.
50
+ attr_accessor :match_methods
51
+
52
+ # The conductor's display name: one register spelling of the key.
53
+ attr_accessor :conductor_name
54
+
55
+ # all (every study of the conductor), mandated (studies a regulator required) or voluntary (studies the registrant says it did not require); studies with an unknown mandate are in all only. The mandated and voluntary books slip differently: choose a stratum.
56
+ attr_accessor :mandate_stratum
57
+
58
+ # Distinct registered studies the conductor is named as conducting institution on.
59
+ attr_accessor :lifetime_studies
60
+
61
+ # Conducting studies with both a planned and an actual final report date.
62
+ attr_accessor :final_report_pairs
63
+
64
+ # Conducting studies with a final report slip (both dates present and different); the N of the figures and the denominator of the floor.
65
+ attr_accessor :comparable_pairs
66
+
67
+ # Of the final_report_pairs, the studies whose planned and actual date are equal to the day (a likely backfill, a form artefact). Excluded from every figure, counted here.
68
+ attr_accessor :backfilled_pairs
69
+
70
+ # backfilled_pairs over final_report_pairs; null when there is no pair.
71
+ attr_accessor :backfilled_share
72
+
73
+ # The share of the conductor's conducting studies a regulator required; read it beside any figure to see how mandated the book is. Null when the conductor has no conducting study.
74
+ attr_accessor :mandated_share
75
+
76
+ # The floor on comparable_pairs below which the four distribution figures are null (suppressed, not zero): 10.
77
+ attr_accessor :n_floor
78
+
79
+ # True when comparable_pairs reaches n_floor, so the four figures are shown; false means they are null and the studies are in provider_rwd_delivery_study.
80
+ attr_accessor :meets_n_floor
81
+
82
+ # Median final report slip in days against the planned date (positive is late) over the comparable pairs; null below the floor.
83
+ attr_accessor :median_slip_days
84
+
85
+ # First quartile of the final report slip in days; null below the floor.
86
+ attr_accessor :p25_slip_days
87
+
88
+ # Third quartile of the final report slip in days; null below the floor.
89
+ attr_accessor :p75_slip_days
90
+
91
+ # Comparable studies whose final report slipped more than 30 days; null below the floor.
92
+ attr_accessor :late_over_30d
93
+
94
+ # The label of the catalogue snapshot the row was read from (a date).
95
+ attr_accessor :snapshot_label
96
+
97
+ # The month and year the catalogue was accessed (YYYY-MM), which EMA's site asks to be cited with its URL.
98
+ attr_accessor :accessed_month
99
+
100
+ # The license restriction tier of the row's source. Every row of this dataset is licensable (PROVISIONAL, legal read pending).
101
+ attr_accessor :restriction_tier
102
+
103
+ # The attribution line EMA requires, including the catalogue URL and the access month; quote it with any figure taken from the row.
104
+ attr_accessor :attribution
105
+
106
+ # Attribute mapping from ruby-style variable name to JSON key.
107
+ def self.attribute_map
108
+ {
109
+ :'provider_rwd_delivery_id' => :'provider_rwd_delivery_id',
110
+ :'provider_id' => :'provider_id',
111
+ :'provider_uuid' => :'provider_uuid',
112
+ :'provider_slug' => :'provider_slug',
113
+ :'provider_name' => :'provider_name',
114
+ :'institution_id' => :'institution_id',
115
+ :'match_method' => :'match_method',
116
+ :'match_confidence' => :'match_confidence',
117
+ :'conductor_name_key' => :'conductor_name_key',
118
+ :'matched_institution_ids' => :'matched_institution_ids',
119
+ :'match_methods' => :'match_methods',
120
+ :'conductor_name' => :'conductor_name',
121
+ :'mandate_stratum' => :'mandate_stratum',
122
+ :'lifetime_studies' => :'lifetime_studies',
123
+ :'final_report_pairs' => :'final_report_pairs',
124
+ :'comparable_pairs' => :'comparable_pairs',
125
+ :'backfilled_pairs' => :'backfilled_pairs',
126
+ :'backfilled_share' => :'backfilled_share',
127
+ :'mandated_share' => :'mandated_share',
128
+ :'n_floor' => :'n_floor',
129
+ :'meets_n_floor' => :'meets_n_floor',
130
+ :'median_slip_days' => :'median_slip_days',
131
+ :'p25_slip_days' => :'p25_slip_days',
132
+ :'p75_slip_days' => :'p75_slip_days',
133
+ :'late_over_30d' => :'late_over_30d',
134
+ :'snapshot_label' => :'snapshot_label',
135
+ :'accessed_month' => :'accessed_month',
136
+ :'restriction_tier' => :'restriction_tier',
137
+ :'attribution' => :'attribution'
138
+ }
139
+ end
140
+
141
+ # Returns attribute mapping this model knows about
142
+ def self.acceptable_attribute_map
143
+ attribute_map
144
+ end
145
+
146
+ # Returns all the JSON keys this model knows about
147
+ def self.acceptable_attributes
148
+ acceptable_attribute_map.values
149
+ end
150
+
151
+ # Attribute type mapping.
152
+ def self.openapi_types
153
+ {
154
+ :'provider_rwd_delivery_id' => :'String',
155
+ :'provider_id' => :'String',
156
+ :'provider_uuid' => :'String',
157
+ :'provider_slug' => :'String',
158
+ :'provider_name' => :'String',
159
+ :'institution_id' => :'String',
160
+ :'match_method' => :'String',
161
+ :'match_confidence' => :'Float',
162
+ :'conductor_name_key' => :'String',
163
+ :'matched_institution_ids' => :'Array<String>',
164
+ :'match_methods' => :'Array<String>',
165
+ :'conductor_name' => :'String',
166
+ :'mandate_stratum' => :'String',
167
+ :'lifetime_studies' => :'Integer',
168
+ :'final_report_pairs' => :'Integer',
169
+ :'comparable_pairs' => :'Integer',
170
+ :'backfilled_pairs' => :'Integer',
171
+ :'backfilled_share' => :'Float',
172
+ :'mandated_share' => :'Float',
173
+ :'n_floor' => :'Integer',
174
+ :'meets_n_floor' => :'Boolean',
175
+ :'median_slip_days' => :'Float',
176
+ :'p25_slip_days' => :'Float',
177
+ :'p75_slip_days' => :'Float',
178
+ :'late_over_30d' => :'Integer',
179
+ :'snapshot_label' => :'String',
180
+ :'accessed_month' => :'String',
181
+ :'restriction_tier' => :'String',
182
+ :'attribution' => :'String'
183
+ }
184
+ end
185
+
186
+ # List of attributes with nullable: true
187
+ def self.openapi_nullable
188
+ Set.new([
189
+ :'provider_rwd_delivery_id',
190
+ :'provider_id',
191
+ :'provider_uuid',
192
+ :'provider_slug',
193
+ :'provider_name',
194
+ :'institution_id',
195
+ :'match_method',
196
+ :'match_confidence',
197
+ :'conductor_name_key',
198
+ :'matched_institution_ids',
199
+ :'match_methods',
200
+ :'conductor_name',
201
+ :'mandate_stratum',
202
+ :'lifetime_studies',
203
+ :'final_report_pairs',
204
+ :'comparable_pairs',
205
+ :'backfilled_pairs',
206
+ :'backfilled_share',
207
+ :'mandated_share',
208
+ :'n_floor',
209
+ :'meets_n_floor',
210
+ :'median_slip_days',
211
+ :'p25_slip_days',
212
+ :'p75_slip_days',
213
+ :'late_over_30d',
214
+ :'snapshot_label',
215
+ :'accessed_month',
216
+ :'restriction_tier',
217
+ :'attribution'
218
+ ])
219
+ end
220
+
221
+ # Initializes the object
222
+ # @param [Hash] attributes Model attributes in the form of hash
223
+ def initialize(attributes = {})
224
+ if (!attributes.is_a?(Hash))
225
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PharmaObservatory::ProviderRwdDeliveryRow` initialize method"
226
+ end
227
+
228
+ # check to see if the attribute exists and convert string to symbol for hash key
229
+ acceptable_attribute_map = self.class.acceptable_attribute_map
230
+ attributes = attributes.each_with_object({}) { |(k, v), h|
231
+ if (!acceptable_attribute_map.key?(k.to_sym))
232
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PharmaObservatory::ProviderRwdDeliveryRow`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
233
+ end
234
+ h[k.to_sym] = v
235
+ }
236
+
237
+ if attributes.key?(:'provider_rwd_delivery_id')
238
+ self.provider_rwd_delivery_id = attributes[:'provider_rwd_delivery_id']
239
+ end
240
+
241
+ if attributes.key?(:'provider_id')
242
+ self.provider_id = attributes[:'provider_id']
243
+ end
244
+
245
+ if attributes.key?(:'provider_uuid')
246
+ self.provider_uuid = attributes[:'provider_uuid']
247
+ end
248
+
249
+ if attributes.key?(:'provider_slug')
250
+ self.provider_slug = attributes[:'provider_slug']
251
+ end
252
+
253
+ if attributes.key?(:'provider_name')
254
+ self.provider_name = attributes[:'provider_name']
255
+ end
256
+
257
+ if attributes.key?(:'institution_id')
258
+ self.institution_id = attributes[:'institution_id']
259
+ end
260
+
261
+ if attributes.key?(:'match_method')
262
+ self.match_method = attributes[:'match_method']
263
+ end
264
+
265
+ if attributes.key?(:'match_confidence')
266
+ self.match_confidence = attributes[:'match_confidence']
267
+ end
268
+
269
+ if attributes.key?(:'conductor_name_key')
270
+ self.conductor_name_key = attributes[:'conductor_name_key']
271
+ end
272
+
273
+ if attributes.key?(:'matched_institution_ids')
274
+ if (value = attributes[:'matched_institution_ids']).is_a?(Array)
275
+ self.matched_institution_ids = value
276
+ end
277
+ end
278
+
279
+ if attributes.key?(:'match_methods')
280
+ if (value = attributes[:'match_methods']).is_a?(Array)
281
+ self.match_methods = value
282
+ end
283
+ end
284
+
285
+ if attributes.key?(:'conductor_name')
286
+ self.conductor_name = attributes[:'conductor_name']
287
+ end
288
+
289
+ if attributes.key?(:'mandate_stratum')
290
+ self.mandate_stratum = attributes[:'mandate_stratum']
291
+ end
292
+
293
+ if attributes.key?(:'lifetime_studies')
294
+ self.lifetime_studies = attributes[:'lifetime_studies']
295
+ end
296
+
297
+ if attributes.key?(:'final_report_pairs')
298
+ self.final_report_pairs = attributes[:'final_report_pairs']
299
+ end
300
+
301
+ if attributes.key?(:'comparable_pairs')
302
+ self.comparable_pairs = attributes[:'comparable_pairs']
303
+ end
304
+
305
+ if attributes.key?(:'backfilled_pairs')
306
+ self.backfilled_pairs = attributes[:'backfilled_pairs']
307
+ end
308
+
309
+ if attributes.key?(:'backfilled_share')
310
+ self.backfilled_share = attributes[:'backfilled_share']
311
+ end
312
+
313
+ if attributes.key?(:'mandated_share')
314
+ self.mandated_share = attributes[:'mandated_share']
315
+ end
316
+
317
+ if attributes.key?(:'n_floor')
318
+ self.n_floor = attributes[:'n_floor']
319
+ end
320
+
321
+ if attributes.key?(:'meets_n_floor')
322
+ self.meets_n_floor = attributes[:'meets_n_floor']
323
+ end
324
+
325
+ if attributes.key?(:'median_slip_days')
326
+ self.median_slip_days = attributes[:'median_slip_days']
327
+ end
328
+
329
+ if attributes.key?(:'p25_slip_days')
330
+ self.p25_slip_days = attributes[:'p25_slip_days']
331
+ end
332
+
333
+ if attributes.key?(:'p75_slip_days')
334
+ self.p75_slip_days = attributes[:'p75_slip_days']
335
+ end
336
+
337
+ if attributes.key?(:'late_over_30d')
338
+ self.late_over_30d = attributes[:'late_over_30d']
339
+ end
340
+
341
+ if attributes.key?(:'snapshot_label')
342
+ self.snapshot_label = attributes[:'snapshot_label']
343
+ end
344
+
345
+ if attributes.key?(:'accessed_month')
346
+ self.accessed_month = attributes[:'accessed_month']
347
+ end
348
+
349
+ if attributes.key?(:'restriction_tier')
350
+ self.restriction_tier = attributes[:'restriction_tier']
351
+ end
352
+
353
+ if attributes.key?(:'attribution')
354
+ self.attribution = attributes[:'attribution']
355
+ end
356
+ end
357
+
358
+ # Show invalid properties with the reasons. Usually used together with valid?
359
+ # @return Array for valid properties with the reasons
360
+ def list_invalid_properties
361
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
362
+ invalid_properties = Array.new
363
+ invalid_properties
364
+ end
365
+
366
+ # Check to see if the all the properties in the model are valid
367
+ # @return true if the model is valid
368
+ def valid?
369
+ warn '[DEPRECATED] the `valid?` method is obsolete'
370
+ true
371
+ end
372
+
373
+ # Checks equality by comparing each attribute.
374
+ # @param [Object] Object to be compared
375
+ def ==(o)
376
+ return true if self.equal?(o)
377
+ self.class == o.class &&
378
+ provider_rwd_delivery_id == o.provider_rwd_delivery_id &&
379
+ provider_id == o.provider_id &&
380
+ provider_uuid == o.provider_uuid &&
381
+ provider_slug == o.provider_slug &&
382
+ provider_name == o.provider_name &&
383
+ institution_id == o.institution_id &&
384
+ match_method == o.match_method &&
385
+ match_confidence == o.match_confidence &&
386
+ conductor_name_key == o.conductor_name_key &&
387
+ matched_institution_ids == o.matched_institution_ids &&
388
+ match_methods == o.match_methods &&
389
+ conductor_name == o.conductor_name &&
390
+ mandate_stratum == o.mandate_stratum &&
391
+ lifetime_studies == o.lifetime_studies &&
392
+ final_report_pairs == o.final_report_pairs &&
393
+ comparable_pairs == o.comparable_pairs &&
394
+ backfilled_pairs == o.backfilled_pairs &&
395
+ backfilled_share == o.backfilled_share &&
396
+ mandated_share == o.mandated_share &&
397
+ n_floor == o.n_floor &&
398
+ meets_n_floor == o.meets_n_floor &&
399
+ median_slip_days == o.median_slip_days &&
400
+ p25_slip_days == o.p25_slip_days &&
401
+ p75_slip_days == o.p75_slip_days &&
402
+ late_over_30d == o.late_over_30d &&
403
+ snapshot_label == o.snapshot_label &&
404
+ accessed_month == o.accessed_month &&
405
+ restriction_tier == o.restriction_tier &&
406
+ attribution == o.attribution
407
+ end
408
+
409
+ # @see the `==` method
410
+ # @param [Object] Object to be compared
411
+ def eql?(o)
412
+ self == o
413
+ end
414
+
415
+ # Calculates hash code according to all attributes.
416
+ # @return [Integer] Hash code
417
+ def hash
418
+ [provider_rwd_delivery_id, provider_id, provider_uuid, provider_slug, provider_name, institution_id, match_method, match_confidence, conductor_name_key, matched_institution_ids, match_methods, conductor_name, mandate_stratum, lifetime_studies, final_report_pairs, comparable_pairs, backfilled_pairs, backfilled_share, mandated_share, n_floor, meets_n_floor, median_slip_days, p25_slip_days, p75_slip_days, late_over_30d, snapshot_label, accessed_month, restriction_tier, attribution].hash
419
+ end
420
+
421
+ # Builds the object from hash
422
+ # @param [Hash] attributes Model attributes in the form of hash
423
+ # @return [Object] Returns the model itself
424
+ def self.build_from_hash(attributes)
425
+ return nil unless attributes.is_a?(Hash)
426
+ attributes = attributes.transform_keys(&:to_sym)
427
+ transformed_hash = {}
428
+ openapi_types.each_pair do |key, type|
429
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
430
+ transformed_hash["#{key}"] = nil
431
+ elsif type =~ /\AArray<(.*)>/i
432
+ # check to ensure the input is an array given that the attribute
433
+ # is documented as an array but the input is not
434
+ if attributes[attribute_map[key]].is_a?(Array)
435
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
436
+ end
437
+ elsif !attributes[attribute_map[key]].nil?
438
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
439
+ end
440
+ end
441
+ new(transformed_hash)
442
+ end
443
+
444
+ # Deserializes the data based on type
445
+ # @param string type Data type
446
+ # @param string value Value to be deserialized
447
+ # @return [Object] Deserialized data
448
+ def self._deserialize(type, value)
449
+ case type.to_sym
450
+ when :Time
451
+ Time.parse(value)
452
+ when :Date
453
+ Date.parse(value)
454
+ when :String
455
+ value.to_s
456
+ when :Integer
457
+ value.to_i
458
+ when :Float
459
+ value.to_f
460
+ when :Boolean
461
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
462
+ true
463
+ else
464
+ false
465
+ end
466
+ when :Object
467
+ # generic object (usually a Hash), return directly
468
+ value
469
+ when /\AArray<(?<inner_type>.+)>\z/
470
+ inner_type = Regexp.last_match[:inner_type]
471
+ value.map { |v| _deserialize(inner_type, v) }
472
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
473
+ k_type = Regexp.last_match[:k_type]
474
+ v_type = Regexp.last_match[:v_type]
475
+ {}.tap do |hash|
476
+ value.each do |k, v|
477
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
478
+ end
479
+ end
480
+ else # model
481
+ # models (e.g. Pet) or oneOf
482
+ klass = PharmaObservatory.const_get(type)
483
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
484
+ end
485
+ end
486
+
487
+ # Returns the string representation of the object
488
+ # @return [String] String presentation of the object
489
+ def to_s
490
+ to_hash.to_s
491
+ end
492
+
493
+ # to_body is an alias to to_hash (backward compatibility)
494
+ # @return [Hash] Returns the object in the form of hash
495
+ def to_body
496
+ to_hash
497
+ end
498
+
499
+ # Returns the object in the form of hash
500
+ # @return [Hash] Returns the object in the form of hash
501
+ def to_hash
502
+ hash = {}
503
+ self.class.attribute_map.each_pair do |attr, param|
504
+ value = self.send(attr)
505
+ if value.nil?
506
+ is_nullable = self.class.openapi_nullable.include?(attr)
507
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
508
+ end
509
+
510
+ hash[param] = _to_hash(value)
511
+ end
512
+ hash
513
+ end
514
+
515
+ # Outputs non-array value in the form of hash
516
+ # For object, use to_hash. Otherwise, just return the value
517
+ # @param [Object] value Any valid value
518
+ # @return [Hash] Returns the value in the form of hash
519
+ def _to_hash(value)
520
+ if value.is_a?(Array)
521
+ value.compact.map { |v| _to_hash(v) }
522
+ elsif value.is_a?(Hash)
523
+ {}.tap do |hash|
524
+ value.each { |k, v| hash[k] = _to_hash(v) }
525
+ end
526
+ elsif value.respond_to? :to_hash
527
+ value.to_hash
528
+ else
529
+ value
530
+ end
531
+ end
532
+
533
+ end
534
+
535
+ end