Json file aggregations and transformations to .csv










0















I have JSON data structured like this:



[
"eventName": "unmuteClick",
"intPayload":0,
"stringPayload": "",
"playbackId": "49309k-54353esfs-resf43-23fs43jk",
"sessionId": "324435-65657-3256-8787",
"timestamp": 1541632099009,
"pageAsin": "B00K7GXXKQ",
"videoAsin": "B078LXG579v",
"eventName": "muteClick",
"intPayload":1,
"stringPayload": "",
"playbackId": "49309k-54353esfs-resf43-23fs43jk",
"sessionId": "324435-65657-3256-8787",
"timestamp": 1541632099009,
"pageAsin": "B00K7GXXKQ",
"videoAsin": "B078LXG579v",
"eventName": "resumeClick",
"intPayload":1,
"stringPayload": "",
"playbackId": "49309k-54353esfs-resf43-23fs43jk",
"sessionId": "324435-65657-3256-8787",
"timestamp": 15416320990586,
"pageAsin": "B00K7GXXKQ",
"videoAsin": "B078LXG579v",
"eventName": "pauseClick",
"intPayload":1,
"stringPayload": "",
"playbackId": "49309k-54353esfs-resf43-23fs43jk",
"sessionId": "324435-65657-3256-8787",
"timestamp": 15416320990585,
"pageAsin": "B00K7GXXKQ",
"videoAsin": "B078LXG579v",
"eventName": "mediaDuration",
"intPayload":10000,
"stringPayload": "",
"playbackId": "49309k-54353esfs-resf43-23fs43jk",
"sessionId": "324435-65657-3256-8787",
"timestamp": 1541632099010,
"pageAsin": "B00K7GXXKQ",
"videoAsin": "B078LXG579v",
"eventName": "firstQuartileCount",
"intPayload": 1,
"stringPayload": "",
"playbackId": "49309k-54353esfs-resf43-23fs43jk",
"sessionId": "324435-65657-3256-8787",
"timestamp": 1541632099010,
"pageAsin": "B00K7GXXKQ",
"videoAsin": "B078LXG579v",
"eventName": "secondQuartileCount",
"intPayload":1,
"stringPayload": "",
"playbackId": "49309k-54353esfs-resf43-23fs43jk",
"sessionId": "324435-65657-3256-8787",
"timestamp": 1541632099010,
"pageAsin": "B00K7GXXKQ",
"videoAsin": "B078LXG579v",
"eventName": "thirdQuartileCount",
"intPayload":0,
"stringPayload": "",
"playbackId": "49309k-54353esfs-resf43-23fs43jk",
"sessionId": "324435-65657-3256-8787",
"timestamp": 1541632099010,
"pageAsin": "B00K7GXXKQ",
"videoAsin": "B078LXG579v",
"eventName": "completeCount",
"intPayload":0,
"stringPayload": "",
"playbackId": "49309k-54353esfs-resf43-23fs43jk",
"sessionId": "324435-65657-3256-8787",
"timestamp": 1541632099010,
"pageAsin": "B00K7GXXKQ",
"videoAsin": "B078LXG579v"
]


Each record is a different event that can happen during video playback. One video playback has a unique playbackId, so you can see there are 10 events related to the same playback.



What I need to do is aggregate and transform this data to CSV format, where each row would be aggregated results for one playbackId.
I need to transform the values in the eventName field into columns, where the values in the intPayload field are the values of the columns.



Here is the schema I need to use:



playbackId, sessionId, pageAsin, videoAsin, unmuteClick,muteClick, pauseClick, resumeClick, mediaDuration,firstQuartileCount, secondQuartileCount,thirdQuartileCount,completeCount



Based on the data, values for the schema would be like this:



"49309k-54353esfs-resf43-23fs43jk","324435-65657-3256-8787", "B00K7GXXKQ", "B078LXG579v",1,1,1,1,10000,1,1,0,0"



(For the same playbackId, fields like sessionId, pageAsin and videoAsin would be the same.)



Does anything already exist for transformations and aggregations like this? Can I use Elastic Map reduce for calculations like this? The input data size is pretty large.










share|improve this question




























    0















    I have JSON data structured like this:



    [
    "eventName": "unmuteClick",
    "intPayload":0,
    "stringPayload": "",
    "playbackId": "49309k-54353esfs-resf43-23fs43jk",
    "sessionId": "324435-65657-3256-8787",
    "timestamp": 1541632099009,
    "pageAsin": "B00K7GXXKQ",
    "videoAsin": "B078LXG579v",
    "eventName": "muteClick",
    "intPayload":1,
    "stringPayload": "",
    "playbackId": "49309k-54353esfs-resf43-23fs43jk",
    "sessionId": "324435-65657-3256-8787",
    "timestamp": 1541632099009,
    "pageAsin": "B00K7GXXKQ",
    "videoAsin": "B078LXG579v",
    "eventName": "resumeClick",
    "intPayload":1,
    "stringPayload": "",
    "playbackId": "49309k-54353esfs-resf43-23fs43jk",
    "sessionId": "324435-65657-3256-8787",
    "timestamp": 15416320990586,
    "pageAsin": "B00K7GXXKQ",
    "videoAsin": "B078LXG579v",
    "eventName": "pauseClick",
    "intPayload":1,
    "stringPayload": "",
    "playbackId": "49309k-54353esfs-resf43-23fs43jk",
    "sessionId": "324435-65657-3256-8787",
    "timestamp": 15416320990585,
    "pageAsin": "B00K7GXXKQ",
    "videoAsin": "B078LXG579v",
    "eventName": "mediaDuration",
    "intPayload":10000,
    "stringPayload": "",
    "playbackId": "49309k-54353esfs-resf43-23fs43jk",
    "sessionId": "324435-65657-3256-8787",
    "timestamp": 1541632099010,
    "pageAsin": "B00K7GXXKQ",
    "videoAsin": "B078LXG579v",
    "eventName": "firstQuartileCount",
    "intPayload": 1,
    "stringPayload": "",
    "playbackId": "49309k-54353esfs-resf43-23fs43jk",
    "sessionId": "324435-65657-3256-8787",
    "timestamp": 1541632099010,
    "pageAsin": "B00K7GXXKQ",
    "videoAsin": "B078LXG579v",
    "eventName": "secondQuartileCount",
    "intPayload":1,
    "stringPayload": "",
    "playbackId": "49309k-54353esfs-resf43-23fs43jk",
    "sessionId": "324435-65657-3256-8787",
    "timestamp": 1541632099010,
    "pageAsin": "B00K7GXXKQ",
    "videoAsin": "B078LXG579v",
    "eventName": "thirdQuartileCount",
    "intPayload":0,
    "stringPayload": "",
    "playbackId": "49309k-54353esfs-resf43-23fs43jk",
    "sessionId": "324435-65657-3256-8787",
    "timestamp": 1541632099010,
    "pageAsin": "B00K7GXXKQ",
    "videoAsin": "B078LXG579v",
    "eventName": "completeCount",
    "intPayload":0,
    "stringPayload": "",
    "playbackId": "49309k-54353esfs-resf43-23fs43jk",
    "sessionId": "324435-65657-3256-8787",
    "timestamp": 1541632099010,
    "pageAsin": "B00K7GXXKQ",
    "videoAsin": "B078LXG579v"
    ]


    Each record is a different event that can happen during video playback. One video playback has a unique playbackId, so you can see there are 10 events related to the same playback.



    What I need to do is aggregate and transform this data to CSV format, where each row would be aggregated results for one playbackId.
    I need to transform the values in the eventName field into columns, where the values in the intPayload field are the values of the columns.



    Here is the schema I need to use:



    playbackId, sessionId, pageAsin, videoAsin, unmuteClick,muteClick, pauseClick, resumeClick, mediaDuration,firstQuartileCount, secondQuartileCount,thirdQuartileCount,completeCount



    Based on the data, values for the schema would be like this:



    "49309k-54353esfs-resf43-23fs43jk","324435-65657-3256-8787", "B00K7GXXKQ", "B078LXG579v",1,1,1,1,10000,1,1,0,0"



    (For the same playbackId, fields like sessionId, pageAsin and videoAsin would be the same.)



    Does anything already exist for transformations and aggregations like this? Can I use Elastic Map reduce for calculations like this? The input data size is pretty large.










    share|improve this question


























      0












      0








      0








      I have JSON data structured like this:



      [
      "eventName": "unmuteClick",
      "intPayload":0,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 1541632099009,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "muteClick",
      "intPayload":1,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 1541632099009,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "resumeClick",
      "intPayload":1,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 15416320990586,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "pauseClick",
      "intPayload":1,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 15416320990585,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "mediaDuration",
      "intPayload":10000,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 1541632099010,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "firstQuartileCount",
      "intPayload": 1,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 1541632099010,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "secondQuartileCount",
      "intPayload":1,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 1541632099010,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "thirdQuartileCount",
      "intPayload":0,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 1541632099010,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "completeCount",
      "intPayload":0,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 1541632099010,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v"
      ]


      Each record is a different event that can happen during video playback. One video playback has a unique playbackId, so you can see there are 10 events related to the same playback.



      What I need to do is aggregate and transform this data to CSV format, where each row would be aggregated results for one playbackId.
      I need to transform the values in the eventName field into columns, where the values in the intPayload field are the values of the columns.



      Here is the schema I need to use:



      playbackId, sessionId, pageAsin, videoAsin, unmuteClick,muteClick, pauseClick, resumeClick, mediaDuration,firstQuartileCount, secondQuartileCount,thirdQuartileCount,completeCount



      Based on the data, values for the schema would be like this:



      "49309k-54353esfs-resf43-23fs43jk","324435-65657-3256-8787", "B00K7GXXKQ", "B078LXG579v",1,1,1,1,10000,1,1,0,0"



      (For the same playbackId, fields like sessionId, pageAsin and videoAsin would be the same.)



      Does anything already exist for transformations and aggregations like this? Can I use Elastic Map reduce for calculations like this? The input data size is pretty large.










      share|improve this question
















      I have JSON data structured like this:



      [
      "eventName": "unmuteClick",
      "intPayload":0,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 1541632099009,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "muteClick",
      "intPayload":1,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 1541632099009,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "resumeClick",
      "intPayload":1,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 15416320990586,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "pauseClick",
      "intPayload":1,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 15416320990585,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "mediaDuration",
      "intPayload":10000,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 1541632099010,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "firstQuartileCount",
      "intPayload": 1,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 1541632099010,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "secondQuartileCount",
      "intPayload":1,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 1541632099010,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "thirdQuartileCount",
      "intPayload":0,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 1541632099010,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v",
      "eventName": "completeCount",
      "intPayload":0,
      "stringPayload": "",
      "playbackId": "49309k-54353esfs-resf43-23fs43jk",
      "sessionId": "324435-65657-3256-8787",
      "timestamp": 1541632099010,
      "pageAsin": "B00K7GXXKQ",
      "videoAsin": "B078LXG579v"
      ]


      Each record is a different event that can happen during video playback. One video playback has a unique playbackId, so you can see there are 10 events related to the same playback.



      What I need to do is aggregate and transform this data to CSV format, where each row would be aggregated results for one playbackId.
      I need to transform the values in the eventName field into columns, where the values in the intPayload field are the values of the columns.



      Here is the schema I need to use:



      playbackId, sessionId, pageAsin, videoAsin, unmuteClick,muteClick, pauseClick, resumeClick, mediaDuration,firstQuartileCount, secondQuartileCount,thirdQuartileCount,completeCount



      Based on the data, values for the schema would be like this:



      "49309k-54353esfs-resf43-23fs43jk","324435-65657-3256-8787", "B00K7GXXKQ", "B078LXG579v",1,1,1,1,10000,1,1,0,0"



      (For the same playbackId, fields like sessionId, pageAsin and videoAsin would be the same.)



      Does anything already exist for transformations and aggregations like this? Can I use Elastic Map reduce for calculations like this? The input data size is pretty large.







      json amazon-web-services mapreduce aggregate amazon-emr






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 '18 at 7:32









      Dave

      434




      434










      asked Nov 14 '18 at 1:17









      HelloWorldHelloWorld

      4418




      4418






















          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291819%2fjson-file-aggregations-and-transformations-to-csv%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291819%2fjson-file-aggregations-and-transformations-to-csv%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

          Museum of Modern and Contemporary Art of Trento and Rovereto