0441 Design

Software Creators

Data Structures: Festigram objects

There is a lot of different data that goes into FestiGram. Early versions of the project ran mostly on the server, which made it simple: I used SQL queries against the database to link, say, the festival with the bands, linked through another table I called bandlist, although The API and client both refer to this as Lineup.

But this only worked with a network connection, and it cannot be assumed at a festival. So to make the app work, everything had to be moved to the client. So I had to work out the relationships between the different elements of a festival. The core is the event structure:

series => festival => date => day => set

Then, other elements are attached. Each festival has a lineup, and each lineup has artists, etc.

festival => lineup => artist

set => artist

set => stage

date => venue

date => stage

...and more. So I created functional mixins that could be reused. For instance, the relationship between a festival:date is very similar to date:day.

So I call a higher event the superevent, and a lower event the subevent. The mixin declaration for getSubIds is:

// src/store/list/mixins/event/eventSub.js

export default (subList) => { return  {
	getSubIds (id) { 
		return subList.getFiltered(s => s[this.idField] === id)
			.map(s => s.id)
	}  
}}

This function takes the subList (that is, the list of all possible subEvents) and returns and another function, this one taking the id event that we are trying to find subEvents for.

Where this is used: If we are on the Coachella 2019 page, this will find all the dates associated with that festival. The subList is the list of all dates, and the id is the id of the Coachella 2019 festival. It returns the list of all the Coachella 2019 dates, and then those are displayed on the page, as links to those events.

From the Coachella 2019 Weekend Page, the same function returns all the days for weekend, because it has been loaded with the days as the subList instead of the dates.

The methods are mixed in and injected with the dependencies at the same time, in an Object.assign call. This is the mixin/dependency injection call for dates:


Object.assign(dates,
	filterable,
	subjective,
	momentsDate(days, venues),
	futureDate,
	event,
	eventSub(days),
	eventSuper(festivals),
	messageEventConnections,
	dateIds(subjects, lineups),
	dateCheckin(messages),
	dateWithDays(days),
	dateFilters(festivals),
	getPromise,
	dateDetails(subjects, lineups, intentions),
	intendedDate(intentions)
)

The dates object is the target variable, and everything else is an object containing methods being mixed in. The order is critical, but I can never remember it and I have to look it up each time.

But just looking at this assignment shows all the types of functions that dates use, plus all the dependencies needed.

Scroll to top