culturecreates / footlight-aggregator

A tool to inject entities from Artsdata to footlight
0 stars 0 forks source link

Aggregator: theplayhouse.ca events not loading #137

Open saumier opened 6 days ago

saumier commented 6 days ago

The data from Artsdata for theplayhouse.ca does not return keywords in the expected JSON structure. http://api.artsdata.ca/query?sparql=https://raw.githubusercontent.com/culturecreates/footlight-aggregator/main/sparql/query-events-v3.sparql&frame=event_footlight&format=json&source=http://kg.artsdata.ca/culture-creates/footlight/theplayhouse-ca&limit=5&offset=105

Current structure:

"audience": [
  {
    "@value": "Everyone", 
    "@language": "en"
  }
]
saumier commented 6 days ago

@sahalali This is the issue we discussed after the Tuesday standup. I said I would change the context to create a container for @language and copy the frame into the Aggregator repo.

However, I looked into this more carefully and I realized that all the other sites in Footlight Console did not set a language tag for audience. I also noticed that audience was already set in the context to an array using "@container": "@set". This forces an array even if there is only one value.

So I decided to remove the language tag in Console from the audience property and not modify the frame in any way.

You can test again with the same call http://api.artsdata.ca/query?sparql=https://raw.githubusercontent.com/culturecreates/footlight-aggregator/main/sparql/query-events-v3.sparql&frame=event_footlight&format=json&source=http://kg.artsdata.ca/culture-creates/footlight/theplayhouse-ca&limit=5&offset=105

Now the JSON is with an array and no language:

"audience": [
        "Everyone"
      ]

However, this type of data path change (where a string is tagged with a language) could happen again. Can you propose ideas to enhance the code of the aggregator to handle this case more gracefully? One idea is to handle the different literal serializations (@language, en: container, or just a string). Another idea is to report an error for the optional property in question, skip the property and continue loading the event instead of having the event completely fail:

Batch 21 :: (4/5). 
          Error while adding Event {"uri":"https://theplayhouse.ca/en/schedule-and-tickets/liverpool-4-canadas-tribute-beatles-0"}TypeError: value.toLowerCase is not a function
sahalali commented 6 days ago

This fixed the issue. I ran the playhouse aggregator and it is looking good.

saumier commented 2 days ago

However, this type of data path change (where a string is tagged with a language) could happen again. Can you propose ideas to enhance the code of the aggregator to handle this case more gracefully? One idea is to handle the different literal serializations (https://github.com/language, en: container, or just a string). ...

@sahalali How can we prevent the same problem from happening again (see above)?