diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 44e535f..92e87c9 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,10 @@
-
+
+
+
+
@@ -14,6 +17,7 @@
@@ -72,7 +76,7 @@
-
+
@@ -106,7 +110,15 @@
1709144200442
-
+
+
+ 1709144394361
+
+
+
+ 1709144394361
+
+
@@ -127,6 +139,7 @@
-
+
+
\ No newline at end of file
diff --git a/src/lambda_function/parse_to_dynamodb.py b/src/lambda_function/parse_to_dynamodb.py
index e69de29..ca7d2ae 100644
--- a/src/lambda_function/parse_to_dynamodb.py
+++ b/src/lambda_function/parse_to_dynamodb.py
@@ -0,0 +1,61 @@
+import json
+
+import boto3
+from datetime import datetime
+
+class ForecastToDynamoDB()
+ def __init__(self):
+ self.dynamodb = boto3.resource('dynamodb')
+ self.table = self.dynamodb.Table('Forecast')
+
+ def parse_current(self,json_data):
+
+ city = json_data['location']['name']
+ region = json_data['location']['region']
+ localtime = datetime.strptime(json_data['location']['localtime'], '%Y/%m-%d %H:%M')
+ localtime_lastupdate = datetime.strptime(json_data['current']['last_updated'], '%Y/%m-%d %H:%M')
+ current_temp_c = json_data['current']['temp_c']
+ current_condition = json_root['current']['condition']['text']
+ current_windspeed = json_data['current']['wind_kph']
+ current_winddegree = json_data['current']['wind_degree']
+ current_winddir = json_data['current']['wind_dir']
+ current_feelslike_c = json_data['current']['feelslike_c']
+
+ response = self.table.put_item(
+ Item = {
+ 'city': city,
+ 'region': region,
+ 'localtime': localtime,
+ 'localtime_lastupdated': localtime_lastupdate,
+ 'current_tmep_c': current_temp_c,
+ 'current_condition': current_condition,
+ 'current_windspeed': current_windspeed,
+ 'current_winddegree': current_winddegree,
+ 'current_winddir': current_winddir,
+ 'current_feelslike_c': current_feelslike_c,
+ 'current_json': json_data['current']
+ }
+ )
+
+ return response
+
+def lambda_handler(event, context):
+
+ try:
+ handler = ForecastToDynamoDB()
+
+ json_data = json.loads(event['body'])
+
+ response = handler.parse_current(json_data)
+
+ return {
+ 'statusCode': 200,
+ 'body': json.dump({'message':'Item is successfully written in DynamoDB'}),
+ }
+
+ except Exception as e:
+ return {
+ 'statusCode': 500,
+ 'body': json.dump({'error':str(e)}),
+ }
+