Question: Here is the background information on your task We have signed a new account - Daikibo Industrials, a global leader in the manufacturing of heavy
Here is the background information on your task
We have signed a new account Daikibo Industrials, a global leader in the manufacturing of heavy machinery, founded and headquartered in Tokyo, Japan. They needed assistance with a variety of problems and were impressed to find out Deloitte could help in all verticals.
Daikibo is in the process of integrating IIoT Industrial InternetofThingsdevices to monitor, measure and analyze their manufacturing processes. Half of their infrastructure uses devices streaming telemetry data in one format, and the other half in another. They need your help to combine the two.
Here is your task
Take the following steps to complete the task:
Create an account at repl.it
Fork this project into your workspace.
After navigating to the project find the Fork button on the page and press it
Get acquainted with the data formats by exploring the files hint: it's the same message, represented in different formats:
datajsondatajson
Explore the target unified format by looking at the file dataresult.json. This is the format you should aim to output in your solution.
Complete the solution located in the file main.py
The project is setup in a way to test your solution automatically as you run it
Find the functions in need of implementation and finish them look for comment lines starting with "IMPLEMENT:"
Use repl.it to run your project and test your solution look for a big Run button, currently located at the top
Don't mind the red color of the console output and the message on failed repl process when you run the project the important thing is to see no failures in the tests.
Successful tests produce output looking similar to this
Please use comments in main.pyif you need to leave notes on your solution.
Hint: notice the timestamps of the telemetry formats are different, but the target format is exactly like one of them millisecondsYou will need to convert the other format ISOto itCheck the resources for a link to a SO post that can help.
In the next step you will submit your solution.
import json, unittest, datetime
with opendatajson","ras f:
jsonDatajsonloadf
with opendatajson","ras f:
jsonDatajsonloadf
with opendataresult.json","ras f:
jsonExpectedResult jsonloadf
def convertFromFormatjsonObject:
# IMPLEMENT: Conversion From Type
return NotImplemented
def convertFromFormatjsonObject:
# IMPLEMENT: Conversion From Type
return NotImplemented
def main jsonObject:
result
if jsonObjectgetdeviceNone:
result convertFromFormatjsonObject
else:
result convertFromFormatjsonObject
return result
class TestSolutionunittestTestCase:
def testsanityself:
result jsonloadsjsondumpsjsonExpectedResult
self.assertEqual
result,
jsonExpectedResult
def testdataTypeself:
result main jsonData
self.assertEqual
result,
jsonExpectedResult,
'Converting from Type failed
def testdataTypeself:
result main jsonData
self.assertEqual
result,
jsonExpectedResult,
'Converting from Type failed
if namemain:
unittest.main
datajson file content below
"deviceID": dhdslkja",
"deviceType": "LaserCutter",
"timestamp":
"location": "japantokyokeiyindustrialzonedaikibofactorymeiyosection
"operationStatus": "healthy",
"temp":
datajson file content below
"device":
id: dhdslkja",
"type": "LaserCutter"
"timestamp": T::Z
"country": "japan",
"city": "tokyo",
"area": "keiyindustrialzone",
"factory": "daikibofactorymeiyo",
"section": "section
"data":
"status": "healthy",
"temperature":
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
