0

I'm building a site that scrapes The List, a collection of upcoming concerts in the SF Bay Area in order to power an application that serves the listings up in a modern web GUI.

Right now, I have a web worker that writes to disk a claim that has a folder for each stage of the scraping process: grabbing the raw HTML, scraping the HTML, and transforming the scraped results into something that is structured. The final file is a JSON file with a bunch of objects that look like this:

  {
    "band": "Willie Nelson And Family",
    "date": "2018-10-17T00:00:00-07:00",
    "numberOfShows": "1 show",
    "venue": "Graton Resort, 288 Golf course Dr., Rohnert Park",
    "time": "8pm",
    "soldOut": false,
    "pit": false,
    "multiDay": false,
    "ages": "21+",
    "price": "$250"
  }

I want to import this file on a recurring basis into graphcool, where I plan to have three entities:

  1. an artist, which is just the name of the band
  2. a venue, which is the name of the venue and possibly an address
  3. a show, which is one or many artists at a given venue on a given date and time

My question is twofold:

  1. How do I restructure this JSON file in order to structure it in a way that graphcool will like?

and

  1. How do I upload the contents of this file to graphcool on a recurring basis?
fox
  • 15,428
  • 20
  • 55
  • 85
  • I have one answer to #2 above: it's possible to create a node script with a library like `graphql-request` or `apollo-client` and then generate a repeating mutation using `create{model name}` with required constructor information. – fox Feb 02 '18 at 01:29
  • Answered this question over [here](https://stackoverflow.com/questions/48597470/graphql-graphcool-how-to-write-a-mutation-that-links-both-a-oneone-and-a-onem). – fox Feb 05 '18 at 03:21

0 Answers0