openactive / implementation-tracker

Activation Issue Tracker for OpenActive Implementations
1 stars 2 forks source link

Upshot #198

Closed zerolab closed 1 year ago

zerolab commented 5 years ago

Open endpoint for QA:

https://staging.upshot.org.uk/api/v0/openactive/v1.0/

-- AND / OR --

Sample JSON:

{
  "items": [{
    "id": "875336d628cd56e5",
    "state": "updated",
    "kind": "session",
    "modified": 1539792096632541,
    "data": {
      "@context": "https://openactive.io/",
      "type": "Event",
      "url": "https://staging.upshot.org.uk/calendar/sessions/5de61edc/#calendar/2018-10",
      "identifier": "875336d628cd56e5",
      "name": "Pseudo Aqua Fit session",
      "startDate": "2018-10-16T11:00:00Z",
      "endDate": "2018-10-16T12:00:00Z",
      "duration": "PT60M",
      "location": {
        "type": "Place",
        "url": "https://staging.pitchfinder.org.uk/detail/2417/",
        "name": "Chelsea Sports Centre",
        "address": {
          "type": "PostalAddress",
          "streetAddress": "Chelsea Manor Street, ",
          "addressLocality": "Chelsea",
          "addressRegion": "Greater London",
          "postalCode": "SW3 5PL",
          "addressCountry": "GB"
        },
        "geo": {
          "type": "GeoCoordinates",
          "latitude": 51.4874026528409,
          "longitude": -0.167837363442988
        }
      },
      "organizer": {
        "type": "Organization",
        "name": "Beyond Sport"
      },
      "eventStatus": "https://schema.org/EventScheduled",
      "activity": [{
        "type": "Concept",
        "prefLabel": "Pseudo Aqua Fit"
      }],
      "category": ["Health and well-being sessions "],
      "offers": [{
        "type": "Offer",
        "price": 0
      }]
    }
  }, {
    "id": "bede0bb10567703f",
    "state": "updated",
    "kind": "session",
    "modified": 1541070677512432,
    "data": {
      "@context": "https://openactive.io/",
      "type": "Event",
      "url": "https://staging.upshot.org.uk/calendar/sessions/5de61edc/#calendar/2018-10",
      "identifier": "bede0bb10567703f",
      "name": "AAA Project Report Test - Activity 1 session",
      "startDate": "2018-10-26T09:00:00Z",
      "endDate": "2018-10-26T10:00:00Z",
      "duration": "PT60M",
      "location": {
        "type": "Place",
        "url": "https://staging.pitchfinder.org.uk/detail/3015/",
        "name": "Anfield - Liverpool FC",
        "address": {
          "type": "PostalAddress",
          "streetAddress": "Anfield Road, ",
          "addressLocality": "Liverpool",
          "addressRegion": "Merseyside",
          "postalCode": "L4 0TH",
          "addressCountry": "GB"
        },
        "geo": {
          "type": "GeoCoordinates",
          "latitude": 53.4312673179119,
          "longitude": -2.96158396271265
        }
      },
      "organizer": {
        "type": "Organization",
        "name": "Beyond Sport"
      },
      "eventStatus": "https://schema.org/EventScheduled",
      "activity": [{
        "type": "Concept",
        "prefLabel": "AAA Project Report Test - Activity 1"
      }],
      "category": ["Anti-bullying sessions "],
      "offers": [{
        "type": "Offer",
        "price": 0
      }]
    }
  }, {
    "id": "d6d673d86a9c7b6e",
    "state": "updated",
    "kind": "session",
    "modified": 1541070682295807,
    "data": {
      "@context": "https://openactive.io/",
      "type": "Event",
      "url": "https://staging.upshot.org.uk/calendar/sessions/5de61edc/#calendar/2018-10",
      "identifier": "d6d673d86a9c7b6e",
      "name": "Pseudo Aqua Fit session",
      "startDate": "2018-10-09T11:00:00Z",
      "endDate": "2018-10-09T12:00:00Z",
      "duration": "PT60M",
      "location": {
        "type": "Place",
        "url": "https://staging.pitchfinder.org.uk/detail/2417/",
        "name": "Chelsea Sports Centre",
        "address": {
          "type": "PostalAddress",
          "streetAddress": "Chelsea Manor Street, ",
          "addressLocality": "Chelsea",
          "addressRegion": "Greater London",
          "postalCode": "SW3 5PL",
          "addressCountry": "GB"
        },
        "geo": {
          "type": "GeoCoordinates",
          "latitude": 51.4874026528409,
          "longitude": -0.167837363442988
        }
      },
      "organizer": {
        "type": "Organization",
        "name": "Beyond Sport"
      },
      "eventStatus": "https://schema.org/EventScheduled",
      "activity": [{
        "type": "Concept",
        "prefLabel": "Pseudo Aqua Fit"
      }],
      "category": ["Health and well-being sessions "],
      "offers": [{
        "type": "Offer",
        "price": 0
      }]
    }
  }, {
    "id": "d655c07c80856756",
    "state": "updated",
    "kind": "session",
    "modified": 1541070685606558,
    "data": {
      "@context": "https://openactive.io/",
      "type": "Event",
      "url": "https://staging.upshot.org.uk/calendar/sessions/5de61edc/#calendar/2018-10",
      "identifier": "d655c07c80856756",
      "name": "Pseudo Aqua Fit session",
      "startDate": "2018-10-02T11:00:00Z",
      "endDate": "2018-10-02T12:00:00Z",
      "duration": "PT60M",
      "location": {
        "type": "Place",
        "url": "https://staging.pitchfinder.org.uk/detail/2417/",
        "name": "Chelsea Sports Centre",
        "address": {
          "type": "PostalAddress",
          "streetAddress": "Chelsea Manor Street, ",
          "addressLocality": "Chelsea",
          "addressRegion": "Greater London",
          "postalCode": "SW3 5PL",
          "addressCountry": "GB"
        },
        "geo": {
          "type": "GeoCoordinates",
          "latitude": 51.4874026528409,
          "longitude": -0.167837363442988
        }
      },
      "organizer": {
        "type": "Organization",
        "name": "Beyond Sport"
      },
      "eventStatus": "https://schema.org/EventScheduled",
      "activity": [{
        "type": "Concept",
        "prefLabel": "Pseudo Aqua Fit"
      }],
      "category": ["Health and well-being sessions "],
      "offers": [{
        "type": "Offer",
        "price": 0
      }]
    }
  }, {
    "id": "77a3acec4ef61bbd",
    "state": "updated",
    "kind": "session",
    "modified": 1541070689684095,
    "data": {
      "@context": "https://openactive.io/",
      "type": "Event",
      "url": "https://staging.upshot.org.uk/calendar/sessions/5de61edc/#calendar/2018-11",
      "identifier": "77a3acec4ef61bbd",
      "name": "AAA Project Report Test - Activity 1 session",
      "startDate": "2018-11-26T10:00:00Z",
      "endDate": "2018-11-26T11:00:00Z",
      "duration": "PT60M",
      "location": {
        "type": "Place",
        "url": "https://staging.pitchfinder.org.uk/detail/3015/",
        "name": "Anfield - Liverpool FC",
        "address": {
          "type": "PostalAddress",
          "streetAddress": "Anfield Road, ",
          "addressLocality": "Liverpool",
          "addressRegion": "Merseyside",
          "postalCode": "L4 0TH",
          "addressCountry": "GB"
        },
        "geo": {
          "type": "GeoCoordinates",
          "latitude": 53.4312673179119,
          "longitude": -2.96158396271265
        }
      },
      "organizer": {
        "type": "Organization",
        "name": "Beyond Sport"
      },
      "eventStatus": "https://schema.org/EventScheduled",
      "activity": [{
        "type": "Concept",
        "prefLabel": "AAA Project Report Test - Activity 1"
      }],
      "category": ["Anti-bullying sessions "],
      "offers": [{
        "type": "Offer",
        "price": 0
      }]
    }
  }, {
    "id": "8690529134d4798a",
    "state": "updated",
    "kind": "session",
    "modified": 1541070704532739,
    "data": {
      "@context": "https://openactive.io/",
      "type": "Event",
      "url": "https://staging.upshot.org.uk/calendar/sessions/5de61edc/#calendar/2018-3",
      "identifier": "8690529134d4798a",
      "name": "test",
      "startDate": "2018-03-27T11:00:00Z",
      "endDate": "2018-03-27T12:00:00Z",
      "duration": "PT60M",
      "location": {
        "type": "Place",
        "url": "https://staging.pitchfinder.org.uk/",
        "name": "Benson Primary School",
        "address": {
          "type": "PostalAddress",
          "streetAddress": "Oxford Road, , Benson",
          "addressLocality": "Wallingford",
          "addressRegion": "Oxfordshire",
          "postalCode": "OX10 6LX",
          "addressCountry": "GB"
        },
        "geo": {
          "type": "GeoCoordinates",
          "latitude": 51.6212371678924,
          "longitude": -1.11290650744099
        }
      },
      "organizer": {
        "type": "Organization",
        "name": "Beyond Sport"
      },
      "eventStatus": "https://schema.org/EventScheduled",
      "activity": [{
        "type": "Concept",
        "prefLabel": "Mountain bike programme"
      }],
      "category": ["Football session"],
      "offers": [{
        "type": "Offer",
        "price": 0
      }]
    }
  }, {
    "id": "0833cc0a8f74fcbb",
    "state": "updated",
    "kind": "session",
    "modified": 1541072820360737,
    "data": {
      "@context": "https://openactive.io/",
      "type": "Event",
      "url": "https://staging.upshot.org.uk/calendar/sessions/31049376/#calendar/2018-9",
      "identifier": "0833cc0a8f74fcbb",
      "name": "Recurring session",
      "startDate": "2018-09-01T08:15:00Z",
      "endDate": "2018-09-01T08:30:00Z",
      "duration": "PT15M",
      "location": {
        "type": "Place",
        "url": "https://staging.pitchfinder.org.uk/",
        "name": "Torchbox Bristol",
        "address": {
          "type": "PostalAddress",
          "streetAddress": "15 Colston st, ",
          "addressLocality": "Bristol",
          "addressRegion": null,
          "postalCode": "BS1 5AP",
          "addressCountry": "GB"
        },
        "geo": {
          "type": "GeoCoordinates",
          "latitude": 51.4554436314615,
          "longitude": -2.59774495378551
        }
      },
      "organizer": {
        "type": "Organization",
        "name": "OpenActive Test"
      },
      "eventStatus": "https://schema.org/EventScheduled",
      "activity": [{
        "type": "Concept",
        "prefLabel": "OpenActive QA"
      }],
      "category": ["Social events"],
      "offers": [{
        "type": "Offer",
        "price": 0
      }]
    }
  }, {
    "id": "6e9c403b1a6535d7",
    "state": "updated",
    "kind": "session",
    "modified": 1541072820413520,
    "data": {
      "@context": "https://openactive.io/",
      "type": "Event",
      "url": "https://staging.upshot.org.uk/calendar/sessions/31049376/#calendar/2018-9",
      "identifier": "6e9c403b1a6535d7",
      "name": "Recurring session",
      "startDate": "2018-09-08T08:15:00Z",
      "endDate": "2018-09-08T08:30:00Z",
      "duration": "PT15M",
      "location": {
        "type": "Place",
        "url": "https://staging.pitchfinder.org.uk/",
        "name": "Torchbox Bristol",
        "address": {
          "type": "PostalAddress",
          "streetAddress": "15 Colston st, ",
          "addressLocality": "Bristol",
          "addressRegion": null,
          "postalCode": "BS1 5AP",
          "addressCountry": "GB"
        },
        "geo": {
          "type": "GeoCoordinates",
          "latitude": 51.4554436314615,
          "longitude": -2.59774495378551
        }
      },
      "organizer": {
        "type": "Organization",
        "name": "OpenActive Test"
      },
      "eventStatus": "https://schema.org/EventScheduled",
      "activity": [{
        "type": "Concept",
        "prefLabel": "OpenActive QA"
      }],
      "category": ["Social events"],
      "offers": [{
        "type": "Offer",
        "price": 0
      }]
    }
  }, {
    "id": "f4af1737950a50c5",
    "state": "updated",
    "kind": "session",
    "modified": 1541072820443560,
    "data": {
      "@context": "https://openactive.io/",
      "type": "Event",
      "url": "https://staging.upshot.org.uk/calendar/sessions/31049376/#calendar/2018-9",
      "identifier": "f4af1737950a50c5",
      "name": "Recurring session",
      "startDate": "2018-09-15T08:15:00Z",
      "endDate": "2018-09-15T08:30:00Z",
      "duration": "PT15M",
      "location": {
        "type": "Place",
        "url": "https://staging.pitchfinder.org.uk/",
        "name": "Torchbox Bristol",
        "address": {
          "type": "PostalAddress",
          "streetAddress": "15 Colston st, ",
          "addressLocality": "Bristol",
          "addressRegion": null,
          "postalCode": "BS1 5AP",
          "addressCountry": "GB"
        },
        "geo": {
          "type": "GeoCoordinates",
          "latitude": 51.4554436314615,
          "longitude": -2.59774495378551
        }
      },
      "organizer": {
        "type": "Organization",
        "name": "OpenActive Test"
      },
      "eventStatus": "https://schema.org/EventScheduled",
      "activity": [{
        "type": "Concept",
        "prefLabel": "OpenActive QA"
      }],
      "category": ["Social events"],
      "offers": [{
        "type": "Offer",
        "price": 0
      }]
    }
  }, {
    "id": "62bd8efa62d89270",
    "state": "updated",
    "kind": "session",
    "modified": 1541072820473428,
    "data": {
      "@context": "https://openactive.io/",
      "type": "Event",
      "url": "https://staging.upshot.org.uk/calendar/sessions/31049376/#calendar/2018-9",
      "identifier": "62bd8efa62d89270",
      "name": "Recurring session",
      "startDate": "2018-09-22T08:15:00Z",
      "endDate": "2018-09-22T08:30:00Z",
      "duration": "PT15M",
      "location": {
        "type": "Place",
        "url": "https://staging.pitchfinder.org.uk/",
        "name": "Torchbox Bristol",
        "address": {
          "type": "PostalAddress",
          "streetAddress": "15 Colston st, ",
          "addressLocality": "Bristol",
          "addressRegion": null,
          "postalCode": "BS1 5AP",
          "addressCountry": "GB"
        },
        "geo": {
          "type": "GeoCoordinates",
          "latitude": 51.4554436314615,
          "longitude": -2.59774495378551
        }
      },
      "organizer": {
        "type": "Organization",
        "name": "OpenActive Test"
      },
      "eventStatus": "https://schema.org/EventScheduled",
      "activity": [{
        "type": "Concept",
        "prefLabel": "OpenActive QA"
      }],
      "category": ["Social events"],
      "offers": [{
        "type": "Offer",
        "price": 0
      }]
    }
  }],
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "next": "https://staging.upshot.org.uk/api/v0/openactive/v1.0/?afterTimestamp=1541072820473428&afterId=62bd8efa62d89270"
}

A few notes:

nickevansuk commented 5 years ago

Primary Issue

Issue Description

Without providing a means of grouping the Events, the nature of Upshot's creation of "X sessions at the same time" will currently cause a large volume of what will appear to be duplicate data to be surfaced (i.e. a large volume of Events that vary on date/time alone, without any other variance between them). This makes the data substantially less useful, and therefore much less likely to be used by data consumers.

Background

This draft document explains the various types of groupings available within the OpenActive V2.0 model: https://docs.google.com/document/d/1C_eO6JC8tt7-K-XiilHzPKXKenjjHiiOS7nCW07tlLk/edit

Observations

Suggested solution

SessionSeries and ScheduledSession should be used, as this is the best fit for the type of regular sessions often captured in Upshot, and Event used for purely ad-hoc sessions.

Based on the above, we suggest the best solution is pulling the upshot "activity" out into an EventSeries and using the "inverse" representation via superEvent to minimise changes to the feed at this stage.

The following are recommended for the two different types of Upshot sessions:

1) For generated sessions: ScheduledSession -> SessionSeries -> EventSeries

This assumes that when organisations add recurring sessions with a specified frequency and a total of sessions, that there is some common key that links the generated sessions together - e.g. to allow them to be updated in bulk later. This would be the "SessionSeries" identifier. SessionSeries can be used without an eventSchedule at this stage to indicate the grouping of ScheduledSessions, and the eventSchedule can be added later via e.g. deriving a recurrence pattern as you suggest.

If the location can't be included in the SessionSeries it should be included in the ScheduledSession.

Note there is a known bug in the validator: it does not recognise property inheritance across three levels, which causes errors for the below.

{
  "id": "62bd8efa62d89270",
  "state": "updated",
  "kind": "ScheduledSession.SessionSeries",
  "modified": 1541072820473428,
  "data": {
    "@context": "https://openactive.io/",
    "type": "ScheduledSession",
    "identifier": "62bd8efa62d89270",
    "name": "OpenActive QA - Recurring session (concat to match calendar title)",
    "startDate": "2018-09-22T08:15:00Z",
    "endDate": "2018-09-22T08:30:00Z",
    "duration": "PT15M",
    "eventStatus": "https://schema.org/EventScheduled",
    "superEvent": {
      "type": "SessionSeries",
      "identifier": "recurrenceGenerationId?",
      "location": {
        "type": "Place",
        "url": "https://staging.pitchfinder.org.uk/",
        "name": "Torchbox Bristol",
        "address": {
          "type": "PostalAddress",
          "streetAddress": "15 Colston st",
          "addressLocality": "Bristol",
          "addressRegion": "Test",
          "postalCode": "BS1 5AP",
          "addressCountry": "GB"
        },
        "geo": {
          "type": "GeoCoordinates",
          "latitude": 51.4554436314615,
          "longitude": -2.59774495378551
        }
      },
      "superEvent": {
        "type": "EventSeries",
        "identifier": "activityId?",
        "name": "OpenActive QA",
        "description": "Activity description",
        "organizer": {
          "type": "Organization",
          "name": "OpenActive Test"
        },
        "activity": [
          {
            "type": "Concept",
            "prefLabel": "OpenActive QA"
          }
        ],
        "url": "https://staging.upshot.org.uk/calendar/sessions/31049376/#calendar/2018-9",
        "category": [
          "Social events"
        ]
      }
    }
  }
}

2) For ad-hoc events: Event -> EventSeries

Although this is easier to achieve, it must be noted that it is technically inaccurate to represent generated sessions this way, as the generated sessions are not actually ad-hoc events (they are generated from a recurrence pattern). Some data users (e.g. Classfinder) do not consume Events in this format as it is usually reserved for Race for Life events etc, and those data users that do will likely not expect a large volume of recurring sessions generated from a schedule to be represented this way. See here for more info: https://developer.openactive.io/data-model/data-model-overview.

Note however that truly ad-hoc events (i.e. those that are not generated from a schedule) should be presented like this.

A mix of "Event" and "ScheduledSession.SessionSeries" kinds can easily be included in one feed, which will allow Upshot to represent both generated and ad-hoc sessions.

{
  "id": "62bd8efa62d89270",
  "state": "updated",
  "kind": "Event",
  "modified": 1541072820473428,
  "data": {
    "@context": "https://openactive.io/",
    "type": "Event",
    "identifier": "62bd8efa62d89270",
    "name": "OpenActive QA - Recurring session (concat to match calendar title)",
    "startDate": "2018-09-22T08:15:00Z",
    "endDate": "2018-09-22T08:30:00Z",
    "duration": "PT15M",
    "eventStatus": "https://schema.org/EventScheduled",
    "location": {
      "type": "Place",
      "url": "https://staging.pitchfinder.org.uk/",
      "name": "Torchbox Bristol",
      "address": {
        "type": "PostalAddress",
        "streetAddress": "15 Colston St",
        "addressLocality": "Bristol",
        "addressRegion": "Test",
        "postalCode": "BS1 5AP",
        "addressCountry": "GB"
      },
      "geo": {
        "type": "GeoCoordinates",
        "latitude": 51.4554436314615,
        "longitude": -2.59774495378551
      }
    },
    "superEvent": {
      "type": "EventSeries",
      "identifier": "activityId?",
      "name": "OpenActive QA",
      "description": "Activity description",
      "organizer": {
        "type": "Organization",
        "name": "OpenActive Test"
      },
      "activity": [
        {
          "type": "Concept",
          "prefLabel": "OpenActive QA"
        }
      ],
      "url": "https://staging.upshot.org.uk/calendar/sessions/31049376/#calendar/2018-9",
      "category": [
        "Social events"
      ]
    }
  }
}

Other feedback

zerolab commented 5 years ago

Thank you for the feedback @nickevansuk. Will review in depth and assess the changes needed on our side to fit the suggested approaches.

A couple of remarks:

This assumes that when organisations add recurring sessions with a specified frequency and a total of sessions, that there is some common key that links the generated sessions together - e.g. to allow them to be updated in bulk later.

The only thing that groups them together is the activity, so no recurrence id. The existing Activity -> Session and the fact that organisations can run several regular, and a number of irregular sessions for an activity, the "Event -> EventSeries" approach is probably a better fit.

If offers are not available, offers should not be included rather than priced at zero - as zero inaccurately indicates that the sessions are free. The get Upshot to validate without errors, accurate pricing data will need to be captured.

I believe there is a bug with the validator. When offers are not included it shows it as an error.