Skip to content

Commit

Permalink
Merge pull request #2992 from mashehu/automate-hackathon-table
Browse files Browse the repository at this point in the history
Automate hackathon location table
  • Loading branch information
mashehu authored Jan 29, 2025
2 parents c8bc44e + 08ab9b9 commit f838fa9
Show file tree
Hide file tree
Showing 44 changed files with 822 additions and 689 deletions.
1,283 changes: 642 additions & 641 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"sites/*"
],
"dependencies": {
"leaflet-fullscreen": "^1.0.2",
"remark": "^15.0.1",
"unist-util-visit": "^5.0.0"
}
Expand Down
1 change: 1 addition & 0 deletions sites/main-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"katex": "^0.16.11",
"kleur": "^4.1.5",
"leaflet": "^1.9.4",
"leaflet-fullscreen": "^1.0.2",
"lite-youtube-embed": "^0.3.2",
"mermaid": "^10.9.3",
"nanostores": "^0.10.3",
Expand Down
11 changes: 5 additions & 6 deletions sites/main-site/src/components/Leaflet.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@
})
.addTo(m)
.bindPopup(
'<h6><a href="#' +
locationMarker.name.replaceAll('/[^a-z]+/', '-') +
'">' +
locationMarker.name +
'</a></h6>' +
image,
`<h6><a href="${
locationMarker.url.startsWith('/events/')
? locationMarker.url
: locationMarker.name.replaceAll('/[^a-z]+/', '-')
}">${locationMarker.name}</a></h6>${image}`,
);
}
});
Expand Down
90 changes: 90 additions & 0 deletions sites/main-site/src/components/event/EventLocationsTable.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
import type { CollectionEntry } from 'astro:content';
import { getCollection } from 'astro:content';
interface Props {
eventPath: string;
}
// Map of country names to their flag emoji for easier lookup
const COUNTRIES = {
Australia: '🇦🇺',
Belgium: '🇧🇪',
Brazil: '🇧🇷',
Canada: '🇨🇦',
'Czech Republic': '🇨🇿',
Colombia: '🇨🇴',
Denmark: '🇩🇰',
Ethiopia: '🇪🇹',
France: '🇫🇷',
Germany: '🇩🇪',
Ghana: '🇬🇭',
Greece: '🇬🇷',
India: '🇮🇳',
Italy: '🇮🇹',
Netherlands: '🇳🇱',
'New Zealand': '🇳🇿',
Pakistan: '🇵🇰',
Poland: '🇵🇱',
'South Africa': '🇿🇦',
Spain: '🇪🇸',
Sweden: '🇸🇪',
Switzerland: '🇨🇭',
Turkey: '🇹🇷',
'United Kingdom': '🇬🇧',
USA: '🇺🇸',
} as const;
const { eventPath } = Astro.props;
// Get location pages for the current event
const locationPages = (await getCollection('events'))
.filter((page) => {
const pagePath = page.id.split('/');
return !pagePath[pagePath.length - 1].includes('index.mdx') && pagePath.slice(0, -1).join('/') === eventPath;
})
.map((page) => {
const country = page.data.locations?.[0]?.country;
return {
...page,
countryInfo: country
? {
name: country,
flag: COUNTRIES[country] || '',
}
: undefined,
};
})
.sort((a, b) => (a.countryInfo?.name ?? '').localeCompare(b.countryInfo?.name ?? ''));
---

<div class="table-responsive">
<table class="table table-hover table-sm small">
<thead>
<tr>
<th>Country</th>
<th>City</th>
<th>Location</th>
<th>Event page</th>
</tr>
</thead>
<tbody>
{
locationPages.map((page) => (
<tr class="position-relative">
<td class="text-nowrap">
{page.countryInfo?.flag} {page.countryInfo?.name}
</td>
<td class="text-nowrap">{page.data.locations?.[0]?.city}</td>
<td>{page.data.locations?.[0]?.name}</td>
<td class="text-nowrap">
<a class="stretched-link" href={`/events/${page.id.replace('.mdx', '')}`}>
Read more
</a>
</td>
</tr>
))
}
</tbody>
</table>
</div>
2 changes: 1 addition & 1 deletion sites/main-site/src/components/event/EventMap.astro
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let local_sites_map: {
if (location && location.geoCoordinates) {
return {
location: location.geoCoordinates,
name: site.data.title,
name: site.data.locations?.[0]?.name ?? site.data.title,
url: '/events/' + site.slug,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
import CopyButton from '@components/CopyButton.svelte';
export let headings: { text: string; slug: string; depth: number; fa_icon?: string }[] = [];
onMount(() => {
if (typeof window !== 'undefined' && window.location.pathname.includes('/events/') && !window.location.hash) {
window.scrollTo(0, 0);
}
async function renderDiagrams(graphs) {
mermaid.initialize({
startOnLoad: false,
Expand Down
6 changes: 6 additions & 0 deletions sites/main-site/src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const events = defineCollection({
links: z.string().url().or(z.string().startsWith('#')).or(z.array(z.string().url())).optional(),
geoCoordinates: z.array(z.number(), z.number()).optional(),
address: z.string().optional(),
country: z.string().optional(),
city: z.string().optional(),
}),
)
.optional(),
Expand Down Expand Up @@ -69,6 +71,10 @@ const events = defineCollection({
if (data.announcement?.text && !data.announcement.start && !data.announcement.end) {
throw new Error('announcement.start and announcement.end must be set if announcement.text is');
}
// check that locations country is set if locations city is set
if (data.locations?.[0]?.city && !data.locations?.[0]?.country) {
throw new Error('locations.country must be set if locations.city is');
}
// Return true if the validation should pass
return true;
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ locations:
links:
- https://ardigen.com/
geoCoordinates: [50.02169897114842, 19.888670603662863]
country: Poland
city: Kraków
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ locations:
links:
- https://www.biocommons.org.au
geoCoordinates: [-33.89157869817327, 151.1877276699427]
country: Australia
city: Sydney
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ locations:
links:
- https://www.loka.com/
geoCoordinates: [4.601261, -74.066064]
country: Colombia
city: Bogota
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ locations:
links:
- https://www.fleming.gr/
geoCoordinates: [37.82465383894673, 23.793974641188694]
country: Greece
city: Athens
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ locations:
- https://www.ceitec.eu/ceitec-mu
- https://www.muni.cz/en/map/complex-3
geoCoordinates: [49.17763845732099, 16.57071755515133]
country: Czech Republic
city: Brno
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ locations:
links:
- https://www.corteva.in/
geoCoordinates: [17.4354298, 78.3802152]
country: India
city: Hyderabad
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ locations:
links:
- https://www.crg.eu/
geoCoordinates: [41.385532, 2.193823]
country: Spain
city: Barcelona
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ locations:
links:
- https://www.dkfz.de/en/index.html
geoCoordinates: [49.41926099905141, 8.675902326327275]
country: Germany
city: Heidelberg
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ locations:
links:
- https://www.ugent.be/
geoCoordinates: [51.025974, 3.728623]
country: Belgium
city: Ghent
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ locations:
links:
- https://www.hartwigmedicalfoundation.nl/
geoCoordinates: [52.3377886059386, 4.872061486319315]
country: Netherlands
city: Amsterdam

layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ locations:
links:
- https://bioinformatics.sph.harvard.edu
geoCoordinates: [42.34502162481195, -71.10233070281164]
country: USA
city: Boston
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ announcement:
---

import EventMap from '@components/event/EventMap.astro';
import EventLocationsTable from '@components/event/EventLocationsTable.astro';

# Welcome

Expand Down Expand Up @@ -61,46 +62,7 @@ For the most recent information about your site as well as the contact details o

<EventMap event={'2025/hackathon-march-2025'} />

<div class="table-responsive" markdown="1">

| Country | City | Location | Event page |
| ----------------- | ------------- | ---------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| 🇦🇺 Australia | Sydney | University of Sydney | [Read more](/events/2025/hackathon-march-2025/biocommons_sydney) |
| 🇧🇪 Belgium | Ghent | Ghent University | [Read more](/events/2025/hackathon-march-2025/ghent-university) |
| 🇧🇷 Brazil | Natal | Federal University of Rio Grande do Norte | [Read more](/events/2025/hackathon-march-2025/university-of-rio-grande-do-norte) |
| 🇧🇷 Brazil | Guarapuava | Federal Technological University of Paraná | [Read more](/events/2025/hackathon-march-2025/utfpr_brazil) |
| 🇨🇦 Canada | Montreal | McGill University offices | [Read more](/events/2025/hackathon-march-2025/montreal-mcgill) |
| 🇨🇿 Czech Republic | Brno | CEITEC MU | [Read more](/events/2025/hackathon-march-2025/ceitec-mu) |
| 🇨🇴 Colombia | Bogota | University of the Andes | [Read more](/events/2025/hackathon-march-2025/bogota-colombia) |
| 🇩🇰 Denmark | Copenhagen | ZS Associates. | [Read more](/events/2025/hackathon-march-2025/zs_cph) |
| 🇪🇹 Ethiopia | Addis Ababa | Nexsis Analytics | [Read more](/events/2025/hackathon-march-2025/nexsis-addis-ethiopia) |
| 🇫🇷 France | Rennes | Institut of Genetics & Development of Rennes | [Read more](/events/2025/hackathon-march-2025/institut-of-genetics-development-of-rennes) |
| 🇩🇪 Germany | Berlin | Robert Koch Institute | [Read more](/events/2025/hackathon-march-2025/robert-koch-institute) |
| 🇩🇪 Germany | Heidelberg | DKFZ and GHGA | [Read more](/events/2025/hackathon-march-2025/dkfz-and-ghga) |
| 🇩🇪 Germany | Munich | TUM/LMU Munich | [Read more](/events/2025/hackathon-march-2025/tumlmu-munich) |
| 🇩🇪 Germany | Tuebingen | University of Tuebingen | [Read more](/events/2025/hackathon-march-2025/qbic-uni-of-tuebingen.mdx) |
| 🇬🇭 Ghana | Accra | Noguchi Memorial Institute of Medical Research | [Read more](/events/2025/hackathon-march-2025/nmimr-ghana) |
| 🇬🇷 Greece | Athens | BSRC Alexander Fleming | [Read more](/events/2025/hackathon-march-2025/bsrc-alexander-fleming) |
| 🇮🇳 India | Hyderabad | Corteva AgriScience & Perimatrix IT | [Read more](/events/2025/hackathon-march-2025/corteva-perimatrix-hyderabad) |
| 🇮🇹 Italy | Pavia | University of Pavia | [Read more](/events/2025/hackathon-march-2025/university-of-pavia) |
| 🇮🇹 Italy | Salerno | University of Salerno | [Read more](/events/2025/hackathon-march-2025/university-of-salerno) |
| 🇳🇱 Netherlands | Amsterdam | Hartwig Medical Foundation | [Read more](/events/2025/hackathon-march-2025/hartwig-medical-foundation) |
| 🇳🇿 New Zealand | Hamilton | NetValue Ltd | [Read more](/events/2025/hackathon-march-2025/netvalue) |
| 🇵🇰 Pakistan | Islamabad | National University of Sciences and Technology | [Read more](/events/2025/hackathon-march-2025/national-university-of-sciences-and-technology-nust) |
| 🇵🇱 Poland | Kraków | Ardigen | [Read more](/events/2025/hackathon-march-2025/ardigen) |
| 🇿🇦 South Africa | Cape Town | Stellenbosch University | [Read more](/events/2025/hackathon-march-2025/stellenbosch-university-cape-town) |
| 🇪🇸 Spain | Barcelona | CRG | [Read more](/events/2025/hackathon-march-2025/crg) |
| 🇪🇸 Spain | Barcelona | Seqera | [Read more](/events/2025/hackathon-march-2025/seqera) |
| 🇸🇪 Sweden | Uppsala | Uppsala University | [Read more](/events/2025/hackathon-march-2025/uppsala-university) |
| 🇨🇭 Switzerland | Zürich | Kinderspital Zürich | [Read more](/events/2025/hackathon-march-2025/kinderspital-zurich) |
| 🇬🇧 United Kingdom | Dundee | James Hutton Institute | [Read more](/events/2025/hackathon-march-2025/james-hutton-institute) |
| 🇬🇧 United Kingdom | London | University College London | [Read more](/events/2025/hackathon-march-2025/university-college-london) |
| 🇺🇸 United States | Boston | Harvard Chan School and Broad Institute | [Read more](/events/2025/hackathon-march-2025/harvard-chan-school) |
| 🇺🇸 United States | Dallas | UT Dallas | [Read more](/events/2025/hackathon-march-2025/ut-dallas) |
| 🇺🇸 United States | Miami | Sylvester Comprehensive Cancer Center | [Read more](/events/2025/hackathon-march-2025/university-of-miami) |
| 🇺🇸 United States | San Francisco | Bay Area | [Read more](/events/2025/hackathon-march-2025/san-francisco-bay-area) |

</div>
<EventLocationsTable eventPath="2025/hackathon-march-2025" />

## Host a local site

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ locations:
links:
- https://igdr.univ-rennes.fr/en
geoCoordinates: [48.11770399359654, -1.697578778661792]
country: France
city: Rennes
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ locations:
links:
- https://www.hutton.ac.uk/
geoCoordinates: [56.457404383182634, -3.070138891914946]
country: United Kingdom
city: Dundee
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ locations:
links:
- https://www.kispi.uzh.ch/
geoCoordinates: [47.35169845, 8.571247550166733]
country: Switzerland
city: Zürich
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ locations:
links:
- https://www.mcgill.ca/facilities/downtown-campus
geoCoordinates: [45.502250, -73.575490]
country: Canada
city: Montreal
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ locations:
links:
- https://nust.edu.pk/
geoCoordinates: [33.64628330291216, 72.9974552257028]
country: Pakistan
city: Islamabad
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ locations:
links:
- https://www.netvalue.nz/
geoCoordinates: [-37.781084, 175.275340]
country: New Zealand
city: Hamilton
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ locations:
links:
- https://nexsis.ca
geoCoordinates: [9.0145679, 38.7497422]
country: Ethiopia
city: Addis Ababa
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ locations:
links:
- https://noguchi.ug.edu.gh/
geoCoordinates: [5.634208, 0.183332]
country: Ghana
city: Accra
layout: '@layouts/events/HackathonMarch2025.astro'
---

Expand Down
Loading

0 comments on commit f838fa9

Please sign in to comment.