pharmaobservatory 0.1.21 → 0.1.23

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