Skip to content

Commit

Permalink
Model for an IMF data set.
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeCardinal committed Jan 28, 2019
1 parent 2d28bf6 commit 2c28418
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions other/imf/imf_data_set.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class IMF_DataSet(object):
def __init__(self, database_id, json_data):
self.database_id = database_id
self.time_series = {}
raw_time_series = json_data['CompactData']['DataSet']['Series']['Obs']
for observation in raw_time_series:
key = observation['@TIME_PERIOD']
val = observation['@OBS_VALUE']
self.time_series[key] = val

def __str__(self):
desc = "\nIMF Data Set\n"
desc += "-----------\n"
desc += "Database ID: {0}".format(self.database_id)

return desc

0 comments on commit 2c28418

Please sign in to comment.