Skip to content

Commit 44b13e2

Browse files
committed
Add DPE2025
1 parent 03f6a1d commit 44b13e2

File tree

3 files changed

+111
-0
lines changed
  • backend
    • datastore/src/jvmMain/kotlin/dev/johnoreilly/confetti/backend/datastore
    • service-import/src/jvmMain/kotlin/dev/johnoreilly/confetti/backend/import

3 files changed

+111
-0
lines changed

backend/datastore/src/jvmMain/kotlin/dev/johnoreilly/confetti/backend/datastore/ConferenceId.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ enum class ConferenceId(val id: String) {
4343
AndroidMakers2025("androidmakers2025"),
4444
KotlinConf2025("kotlinconf2025"),
4545
DroidconNYC2025("droidconnyc2025"),
46+
DPE2025("dpe2025"),
4647
;
4748

4849
companion object {
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import dev.johnoreilly.confetti.backend.datastore.ConferenceId
2+
import dev.johnoreilly.confetti.backend.datastore.DConfig
3+
import dev.johnoreilly.confetti.backend.datastore.DRoom
4+
import dev.johnoreilly.confetti.backend.datastore.DSession
5+
import dev.johnoreilly.confetti.backend.datastore.DSpeaker
6+
import dev.johnoreilly.confetti.backend.datastore.DVenue
7+
import dev.johnoreilly.confetti.backend.datastore.DataStore
8+
import dev.johnoreilly.confetti.backend.import.getJsonUrl
9+
import kotlinx.coroutines.runBlocking
10+
import kotlinx.datetime.LocalDate
11+
import kotlinx.datetime.LocalDateTime
12+
import kotlinx.datetime.LocalTime
13+
import kotlinx.datetime.format.char
14+
import net.mbonnin.bare.graphql.asList
15+
import net.mbonnin.bare.graphql.asMap
16+
import net.mbonnin.bare.graphql.asString
17+
import net.mbonnin.bare.graphql.cast
18+
19+
object DPE {
20+
fun import2025(): Int = runBlocking {
21+
val url = "https://storage.googleapis.com/martin-public/dpe_2025.json"
22+
23+
val data = getJsonUrl(url)
24+
25+
val visitedSpeakers = mutableMapOf<String, DSpeaker>()
26+
val sessions = data.asList.mapIndexed { index, it ->
27+
val s = it.asMap
28+
val avatars = s.get("speakerAvatars").asList
29+
val speakers = s.get("speakers").asList
30+
31+
speakers.forEachIndexed { index, it ->
32+
val name = it.asString
33+
visitedSpeakers.merge(
34+
name, DSpeaker(
35+
id = name,
36+
name = name,
37+
bio = null,
38+
tagline = null,
39+
company = null,
40+
companyLogoUrl = null,
41+
city = null,
42+
links = emptyList(),
43+
photoUrl = avatars.getOrNull(index)?.toString(),
44+
sessions = listOf(index.toString())
45+
)
46+
) { old, new ->
47+
old.copy(
48+
sessions = (old.sessions.orEmpty() + new.sessions.orEmpty()).distinct()
49+
)
50+
}
51+
}
52+
DSession(
53+
id = index.toString(),
54+
type = "talk",
55+
title = s.get("title").cast(),
56+
description = s.get("description").cast(),
57+
shortDescription = null,
58+
language = null,
59+
start = localDateTime(s.get("day").cast(), s.get("start").cast()),
60+
end = localDateTime(s.get("day").cast(), s.get("end").cast()),
61+
complexity = null,
62+
feedbackId = null,
63+
tags = emptyList(),
64+
rooms = listOf(s.get("room").cast()),
65+
speakers = speakers.cast(),
66+
links = emptyList(),
67+
)
68+
}
69+
70+
DataStore().write(
71+
sessions = sessions,
72+
rooms = sessions.flatMap { it.rooms }.distinct().map { DRoom(it, it) },
73+
speakers = visitedSpeakers.values.toList(),
74+
partnerGroups = emptyList(),
75+
config = DConfig(
76+
id = ConferenceId.DPE2025.id,
77+
name = "DPE summit",
78+
timeZone = "America/Los_Angeles",
79+
days = listOf(LocalDate(2025, 9, 23), LocalDate(2025, 9,24)),
80+
themeColor = "0xff209BC4"
81+
),
82+
venues = listOf(DVenue(
83+
id = "midway",
84+
name = "Midway San Francisco",
85+
address = "900 Marin St, San Francisco, CA 94124, United States",
86+
latitude = 37.7492816,
87+
longitude = -122.3882693,
88+
description = mapOf("en" to "Nestled in San Francisco’s Dogpatch district, The Midway is a sprawling 40,000-square-foot hub of creativity and innovation, welcoming all to discover, create, interact, and be moved. Our vibrant venue celebrates the confluence of music, art, cutting-edge technology, and culinary arts, offering an array of performances, workshops, and exhibits that spark inspiration at every corner. At The Midway, we’re dedicated to curating an enriching, thought-provoking journey for every visitor, where the unexpected becomes the norm."),
89+
imageUrl = "https://corporate.themidwaysf.com/wp-content/uploads/1697644799134-1080x810.jpeg",
90+
floorPlanUrl = null
91+
))
92+
)
93+
}
94+
}
95+
96+
private fun localDateTime(day: String, time: String): LocalDateTime {
97+
val timeFormat = LocalTime.Format {
98+
hour()
99+
char(':')
100+
minute()
101+
}
102+
103+
val dateFormat = LocalDate.Formats.ISO // yyyy-MM-dd
104+
105+
val date = dateFormat.parse(day)
106+
val time = timeFormat.parse(time)
107+
108+
return LocalDateTime(date, time)
109+
}

backend/service-import/src/jvmMain/kotlin/dev/johnoreilly/confetti/backend/import/Main.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ private suspend fun update(conf: String?): Int {
144144
ConferenceId.DevFestWarsaw2024 -> Sessionize.importDevFestWarsaw2024()
145145
ConferenceId.AndroidMakers2025 -> Sessionize.importAndroidMakers2025()
146146
ConferenceId.KotlinConf2025 -> Sessionize.importKotlinConf2025()
147+
ConferenceId.DPE2025 -> DPE.import2025()
147148
null -> error("")
148149
}
149150
}

0 commit comments

Comments
 (0)