culturecreates / footlight-aggregator

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

Aggregator: new offer pricing #28

Closed saumier closed 9 months ago

saumier commented 11 months ago

Image

saumier commented 11 months ago

Here is the old offer pricing for reference.

Image

sahalali commented 11 months ago

@saumier Can we discuss this after today's standup if you have time?

saumier commented 11 months ago

@sahalali Please leave a comment here to let me know when you have added a description of the Event payload for Offers to our Artsdata APIs for Footlight doc. Thx.

sahalali commented 11 months ago

@saumier Please see the explanation for how offers are getting created in the CMS with different offerConfiguration payloads. Please let me know if you have any queries.

saumier commented 11 months ago

@sahalali Please read my response about offers. https://docs.google.com/document/d/1AOUiZD3wh-J3M1UDpwBjMhBZm2HfhM_8_NgWCy74LLg/edit#heading=h.uuwjq78r4nnq

saumier commented 10 months ago

@sahalali Hi. I am curious about this one. Where you able to get pricing working? Did you test with Gatineau cloud or is there a problem with the data from Artsdata? Thanks for summarizing the current state of the data pipeline here.

sahalali commented 10 months ago

Yes, pricing is working now. I tested pricing with Gatineau, and hope that will work with other sources.

I don't find any problem with the data from Artsdata. That looks good to me.

troughc commented 10 months ago

IGNORE this comment - This event was loaded prior to pricing being available in Aggregator

_@saumier @sahalali the pricing doesn't seem to be working for co-motion events see https://cms.footlight.io/dashboard/63457978637093005071a053/events/add-event/64dfcfdd7d6aa8006433afd6 and https://console.footlight.io/events/footlight%3Aco-motion-ca_plume-latraverse-sequelles-supplementaires Also with other events came in._

saumier commented 10 months ago

@sahalali Tickets have no URL

In the Tout Culture event called "Beyries" https://cms.footlight.io/dashboard/6308ef4a7f771f00431d939a/events/add-event/64af643c3c19fa0064e76b98

Current behaviour: The ticketing link (lien vers la billeterie) is empty Expected behaviour: The ticketing link should be filled in with url from the AggregateOffer from Artsdata.

Image

Open API link: https://api.footlight.io/events/64af643c3c19fa0064e76b98

 "offers": [
      {
        "name": null,
        "additionalType": "PAID",
        "type": "AggregateOffer"
      },
      {
        "name": {
          "fr": ""
        },
        "price": "34",
        "type": "Offer",
        "priceCurrency": "CAD"
      },
      {
        "name": {
          "fr": "carte Odyssée"
        },
        "price": "30",
        "type": "Offer",
        "priceCurrency": "CAD"
      }
    ],

Artsdata link: http://api.artsdata.ca/query?sparql=query_footlight_event_uri&uri=http://kg.footlight.io/resource/maisondelaculture-ca_chanson-beyries&frame=event_footlight&format=json&source=http://kg.artsdata.ca/culture-creates/footlight/maisondelaculture-ca

 "offers": [
        {
          "uri": "http://kg.footlight.io/resource/maisondelaculture-ca_chanson-beyries#Offer_0",
          "type": "Offer",
          "name": {
            "fr": ""
          },
          "price": "34",
          "url": "https://reseau.ovation.ca/pesite.asp?CodeRepresentation=0E03YD\u0026CodeSiteClient=00000V"
        },
        {
          "uri": "http://kg.footlight.io/resource/maisondelaculture-ca_chanson-beyries#AggregateOffer",
          "type": "AggregateOffer",
          "additionalType": [
           "http://kg.footlight.io/resource/Paid"
          ],
          "name": {
            "fr": "Des frais supplémentaires s’appliquent sur les achats en ligne et par téléphone"
          },
          "url": {
            "uri": "https://reseau.ovation.ca/pesite.asp?CodeRepresentation=0E03YD\u0026CodeSiteClient=00000V"
          }
        },
        {
          "uri": "http://kg.footlight.io/resource/maisondelaculture-ca_chanson-beyries#Offer_1",
          "type": "Offer",
          "name": {
            "fr": "carte Odyssée"
          },
          "price": "30"
        }
      ]
sahalali commented 10 months ago

@saumier We use the API to fetch the list of all events from ARtsdata under a source

http://api.artsdata.ca/query?sparql=query_footlight_events&frame=event_footlight&format=json&source=http://kg.artsdata.ca/culture-creates/footlight/maisondelaculture-ca

The event 'http://kg.artsdata.ca/resource/K23-821"' is the 116th event in the list. The event has offers with no aggregate offer.

{ "uri": ["http://kg.artsdata.ca/resource/K23-821"](http://kg.artsdata.ca/resource/K23-821), "type": "Event", "description": { "fr": "Avec son premier album, Landing, BEYRIES a connu un succès populaire au Québec simplement en étant elle-même. Amélie Beyries est née et a grandi dans le quartier montréalais d’Outremont, où elle a commencé à composer des chansons au piano de sa grand-mère à un jeune âge. Mais elle a longtemps gardé ces chansons pour elle. Elle a d’abord bossé en restauration et a tenu une variété d’emplois de bureau, et a vécu des hauts et des bas avant de se commettre à la musique. Inspirée par des artistes qui créent des moments intimes avec leur musique, BEYRIES raconte des histoires simples et sincères sur Landing avec ses paroles et ses mélodies. Les auditeurs ont été interpellés par celles-ci: son premier album s’est écoulé à plus de 11 500 copies et cumule plus de 15 millions d’écoutes sur toutes les plateformes. Les rencontres profondément personnelles qu’elle a faites sur son parcours musical inspirent et informent ses prochaines oeuvres." }, "endDateTime": "2024-05-01T20:00:00-04:00", "image": { "uri": ["http://kg.footlight.io/resource/maisondelaculture-ca_chanson-beyries#imageObject"](http://kg.footlight.io/resource/maisondelaculture-ca_chanson-beyries#imageObject), "url": { "uri": ["https://www.maisondelaculture.ca/salle-odyssee/images/spectacles/chanson/beyries.jpg"](https://www.maisondelaculture.ca/salle-odyssee/images/spectacles/chanson/beyries.jpg) } }, "keywords": [ "chanson" ], "location": [ ["http://kg.artsdata.ca/resource/K2-197"](http://kg.artsdata.ca/resource/K2-197) ], "name": { "fr": "Beyries" }, "offers": [ { "uri": ["http://kg.footlight.io/resource/maisondelaculture-ca_chanson-beyries#Offer_0"](http://kg.footlight.io/resource/maisondelaculture-ca_chanson-beyries#Offer_0), "type": "Offer", "name": { "fr": "" }, "price": "34", "url": ["https://reseau.ovation.ca/pesite.asp?CodeRepresentation=0E03YD&CodeSiteClient=00000V"](https://reseau.ovation.ca/pesite.asp?CodeRepresentation=0E03YD&CodeSiteClient=00000V) }, { "uri": ["http://kg.footlight.io/resource/maisondelaculture-ca_chanson-beyries#Offer_1"](http://kg.footlight.io/resource/maisondelaculture-ca_chanson-beyries#Offer_1), "type": "Offer", "name": { "fr": "carte Odyssée" }, "price": "30" } ], "organizer": [ ["http://kg.artsdata.ca/resource/K16-67"](http://kg.artsdata.ca/resource/K16-67) ], "performer": [ ["http://kg.artsdata.ca/resource/K13-24"](http://kg.artsdata.ca/resource/K13-24) ], "videoUrl": ["https://www.youtube.com/embed/zx_1qRUJzDM"](https://www.youtube.com/embed/zx_1qRUJzDM), "sameAs": [ { "uri": ["http://kg.artsdata.ca/resource/K23-821"](http://kg.artsdata.ca/resource/K23-821) }, { "uri": ["http://kg.footlight.io/resource/maisondelaculture-ca_chanson-beyries"](http://kg.footlight.io/resource/maisondelaculture-ca_chanson-beyries) } ], "startDateTime": "2024-05-01T20:00:00-04:00", "url": { "uri": ["https://www.maisondelaculture.ca/Salle-Odyssee/spectacles/chanson/beyries.html"](https://www.maisondelaculture.ca/Salle-Odyssee/spectacles/chanson/beyries.html) } }

The API for the 12 batch results with batch size 10 is: http://api.artsdata.ca/query?sparql=query_footlight_events&frame=event_footlight&format=json&source=http://kg.artsdata.ca/culture-creates/footlight/maisondelaculture-ca&limit=10&offset=110

sahalali commented 10 months ago

@saumier The API that you provided above in the comment has an aggregator offer. However, the API is different from the one we are using in the aggregator. Please comment if we need to do any modification.

saumier commented 9 months ago

@sahalali The API to Artsdata allows a single event URI to be passed.

Singe Event URI (sparql=query_footlight_event_uri&uri=) http://api.artsdata.ca/query?sparql=query_footlight_event_uri&uri=http://kg.footlight.io/resource/maisondelaculture-ca_chanson-beyries&frame=event_footlight&format=json&source=http://kg.artsdata.ca/culture-creates/footlight/maisondelaculture-ca Batch of events (sparql=query_footlight_events) http://api.artsdata.ca/query?sparql=query_footlight_events&frame=event_footlight&format=json&source=http://kg.artsdata.ca/culture-creates/footlight/maisondelaculture-ca&limit=10&offset=0

saumier commented 9 months ago

@sahalali The ticketing link should be filled in with the url from Artsdata - see the initial test 2 weeks ago

Current behaviour: The ticketing link (lien vers la billeterie) is empty Expected behaviour: The ticketing link should be filled in with url from the AggregateOffer from Artsdata.

troughc commented 9 months ago

@sahalali @saumier In the Footlight console (for Salle Odysée) there is an event that had all the offer (pricing) properties looking good: https://console.footlight.io/events/footlight:maisondelaculture-ca_autres-evenements-ge-senegal However, in the CMS: event ID: 64a2d1c53c19fa0064e60bf2, it’s not showing up.

saumier commented 9 months ago

@troughc Thx for adding this example. The only mistakes in the data from Console is the label (name) for the price 29.50 and the price which has a "," (comma) instead of a period. Please look at with Kim.

@sahalali @dev-aravind Here is the data returned by Artsdata for the event @troughc mentions above:

In CMS we should have the following filled in:

Note: the Offer url can be ignored as we have no place a link per price in the CMS.

Screenshot 2023-09-07 at 4 17 39 PM
 "offers": [
        {
          "uri": "http://kg.footlight.io/resource/maisondelaculture-ca_autres-evenements-ge-senegal#Offer_0",
          "type": "Offer",
          "name": {
            "fr": "| 27,50"
          },
          "price": "29,50",
          "url": "https://reseau.ovation.ca/pesite.asp?CodeRepresentation=0E040O\u0026CodeSiteClient=00000V"
        },
        {
          "uri": "http://kg.footlight.io/resource/maisondelaculture-ca_autres-evenements-ge-senegal#AggregateOffer",
          "type": "AggregateOffer",
          "additionalType": [
            "http://kg.footlight.io/resource/Paid"
          ],
          "name": {
            "fr": "Des frais supplémentaires s’appliquent sur les achats en ligne et par téléphone"
          },
          "url": {
            "uri": "https://reseau.ovation.ca/pesite.asp?CodeRepresentation=0E040O\u0026CodeSiteClient=00000V"
          }
        }
      ]
troughc commented 9 months ago

@saumier I don't understand what the mistake is with the comma so I don't know how to explain to kim.

saumier commented 9 months ago

@dev-aravind The Event ticket is not getting set to Free.

Example event: https://cms.footlight.io/dashboard/63457978637093005071a053/events/add-event/64dfcfdb7d6aa8006433afac

Current behaviour: Event is not getting set to Free

Expected behaviour: Event is set to Free when AggregateOffer "additionalType" is "http://kg.footlight.io/resource/Free".

http://api.artsdata.ca/query?sparql=query_footlight_event_uri&uri=http://kg.footlight.io/resource/co-motion-ca_station-culturelle-momo-la-rentree-culturelle-de-comotion&frame=event_footlight&format=json&source=http://kg.artsdata.ca/culture-creates/footlight/co-motion-ca

 "offers": {
        "uri": "http://kg.footlight.io/resource/co-motion-ca_station-culturelle-momo-la-rentree-culturelle-de-comotion#AggregateOffer",
        "type": "AggregateOffer",
        "additionalType": [
          "http://kg.footlight.io/resource/Free"
        ],
        "url": {
          "uri": "https://www.co-motion.ca/spectacles/station-culturelle-momo-la-rentree-culturelle-de-comotion/"
        }
      }
dev-aravind commented 9 months ago

@saumier The artsdata API that we use in Aggregator is of the format: https://api.artsdata.ca/query?sparql=query_footlight_events&frame=event_footlight&format=json&source=http://kg.artsdata.ca/culture-creates/footlight/co-motion-ca&limit=10&offset=140

(You can find the event mentioned in this issue by searching "K23-887")

The response of this API is different from that of the one you mentioned in the previous comment as it doesn't have the aggregateOffer values. Need your suggestion on this one.

saumier commented 9 months ago

@dev-aravind Hi. My apologies. There was a omission in my SPARQL. I fixed it and now the reponse should be the same from both sparql=query_footlight_events and sparql=query_footlight_event_uri.

BTW you can look at the SPARQLs by clicking the link in the JSON response. So in the future, if there is something wrong with the data you can look at the SPARQL and try to understand and even modify the SPARQL to play around with it. Let me know if you would like me to show you.

dev-aravind commented 9 months ago

@saumier Thank you for that, also I'd love to learn more on SPARQL when I have some free time. I'll let you know.

saumier commented 9 months ago

To test the AggegateOffer type free and paid is being set correctly.

saumier commented 9 months ago

@troughc I looked at a few events in Gatineau Cloud and the pricing looks good. See screen capture. I am assigning to you so you can also do a smoke test (check a couple of events).

Event Le Bal du temps des fêtes

Image

saumier commented 9 months ago

@troughc Actually I found a bug. The Free events are not loading properly. I will send back to Dev.

@dev-aravind The Free events are not getting detected and loaded property.

Check event: La Cour des ossements https://cms.footlight.io/dashboard/6308ef4a7f771f00431d939a/events/add-event/6495d08895ffd60064aaef38

Data from Artsdata

individual event: http://api.artsdata.ca/query?sparql=query_footlight_event_uri&uri=http://kg.footlight.io/resource/gatineau-cloud_33145&frame=event_footlight&format=json&source=http://kg.artsdata.ca/culture-creates/footlight/gatineau-cloud

list of events including gatineau-cloud_33145: http://api.artsdata.ca/query?limit=100&sparql=query_footlight_events&frame=event_footlight&format=json&source=http://kg.artsdata.ca/culture-creates/footlight/gatineau-cloud

 "offers": {
        "uri": "http://kg.footlight.io/resource/gatineau-cloud_33145#AggregateOffer",
        "type": "AggregateOffer",
        "additionalType": [
          "http://kg.footlight.io/resource/Free"
        ]
      }

In this screen grab, the Free button should be selected.

Image

Data from CMS Open API

"offers": [
      {
        "uri": "http://kg.footlight.io/resource/gatineau-cloud_33145#AggregateOffer",
        "type": "AggregateOffer",
        "additionalType": [
          "http://kg.footlight.io/resource/Free"
        ]
      }
    ]

Is this the expected data for CMS?

Please add a unit test for offer pricing so it will be easy to see what is expected. I am not sure "http://kg.footlight.io/resource/Free" is understood by the CMS. I normally see "additionalType": "FREE" and not "additionalType": "http://kg.footlight.io/resource/Free"

I recommend TDD for this type of work. First adding the unit test, check that it fails, and then work on the code to make the unit test pass.

@dev-aravind @sahalali I'm looking forward to reviewing the unit tests for pricing and virtual location :-)

saumier commented 9 months ago

@dev-aravind I made a change to the test input data. Please make the tests pass. https://github.com/culturecreates/footlight-aggregator/commit/797cfe03db6684df64cc1e20af0573a0b26f70e9

dev-aravind commented 9 months ago

@saumier I don't see any change to the input data. Can you please check again and confirm if the data was changed for the api of this format:

https://api.artsdata.ca/query?sparql=query_footlight_events&frame=event_footlight&format=json&source=http://kg.artsdata.ca/culture-creates/footlight/co-motion-ca&limit=10&offset=140

As this is the one that we are currently using in aggregator.

saumier commented 9 months ago

@dev-aravind I will update the API for Artsdata today. Thx. Now that the test passes, it should also work in production when I run aggregator.

dev-aravind commented 9 months ago

@saumier I've raised a PR which has the unit test and fix for this bug. After the ArtsData API is updated you can merge the changes into production.

PS: This change also includes the unit test for #19 as it had the same dependencies.

saumier commented 9 months ago

Tests pass and I am closing this issue.