Public
Edited
Dec 12, 2023
Insert cell
Insert cell
Insert cell
reviewData = [
{"review_id": 0, "username": "user62", "review_text": "I appreciated the emphasis on spiritual principles in this AA meeting. The discussions were deep and meaningful. The camaraderie among members is powerful. I'm grateful to have found this group."},
{"review_id": 1, "username": "user260", "review_text": "I appreciated the emphasis on spiritual principles in this AA meeting. The discussions were deep and meaningful. The camaraderie among members is powerful. I'm grateful to have found this group."},
{"review_id": 2, "username": "user102", "review_text": "Attending this AA discussion group has become a crucial part of my recovery routine. The sharing of experiences and challenges is relatable, and the sense of unity is palpable. Highly recommended for those seeking connection."},
{"review_id": 3, "username": "user447", "review_text": "I attended the open discussion meeting, and the inclusivity was remarkable. The facilitator ensured that everyone had a chance to speak. The meeting fostered a sense of belonging and acceptance. Solid 4 stars!"},
{"review_id": 4, "username": "user184", "review_text": "This AA community provides a safe and non-judgmental space for individuals recovering from alcohol addiction. The diversity of experiences shared adds richness to the discussions. A supportive environment overall."},
{"review_id": 5, "username": "user442", "review_text": "I appreciated the emphasis on spiritual principles in this AA meeting. The discussions were deep and meaningful. The camaraderie among members is powerful. I'm grateful to have found this group."},
{"review_id": 6, "username": "user164", "review_text": "I appreciated the emphasis on spiritual principles in this AA meeting. The discussions were deep and meaningful. The camaraderie among members is powerful. I'm grateful to have found this group."},
{"review_id": 7, "username": "user285", "review_text": "The open speaker meeting was a bit different from what I expected, but it turned out to be a fantastic experience. Hearing personal stories of recovery was both moving and motivating. Definitely worth attending."},
{"review_id": 8, "username": "user213", "review_text": "Attending this AA group has been a game-changer for me. The members are genuine, and the sharing sessions are heartfelt. I highly recommend it for anyone seeking a sense of community in recovery."},
{"review_id": 9, "username": "user473", "review_text": "The accountability-focused AA meeting was exactly what I needed. The group's commitment to supporting each other in staying sober is commendable. I feel more empowered on my journey to recovery."},
{"review_id": 10, "username": "user384", "review_text": "The Big Book study meeting was enlightening. Delving into the 12 steps has given me a new perspective on my recovery journey. The group's commitment to sobriety is truly inspiring. Solid 5 stars!"},
{"review_id": 11, "username": "user486", "review_text": "The accountability-focused AA meeting was exactly what I needed. The group's commitment to supporting each other in staying sober is commendable. I feel more empowered on my journey to recovery."},
{"review_id": 12, "username": "user447", "review_text": "Attending this AA group has been a game-changer for me. The members are genuine, and the sharing sessions are heartfelt. I highly recommend it for anyone seeking a sense of community in recovery."},
{"review_id": 13, "username": "user394", "review_text": "This AA community provides a safe and non-judgmental space for individuals recovering from alcohol addiction. The diversity of experiences shared adds richness to the discussions. A supportive environment overall."},
{"review_id": 14, "username": "user304", "review_text": "The accountability-focused AA meeting was exactly what I needed. The group's commitment to supporting each other in staying sober is commendable. I feel more empowered on my journey to recovery."},
{"review_id": 15, "username": "user175", "review_text": "This beginner-friendly AA meeting provided me with the information I needed to start my recovery journey. The members were supportive, and I left with a renewed sense of hope. A valuable experience for newcomers."},
{"review_id": 16, "username": "user462", "review_text": "Attending this AA group has been a game-changer for me. The members are genuine, and the sharing sessions are heartfelt. I highly recommend it for anyone seeking a sense of community in recovery."},
{"review_id": 17, "username": "user406", "review_text": "Attending this AA discussion group has become a crucial part of my recovery routine. The sharing of experiences and challenges is relatable, and the sense of unity is palpable. Highly recommended for those seeking connection."},
{"review_id": 18, "username": "user164", "review_text": "The open speaker meeting was a bit different from what I expected, but it turned out to be a fantastic experience. Hearing personal stories of recovery was both moving and motivating. Definitely worth attending."},
{"review_id": 19, "username": "user238", "review_text": "The Big Book study meeting was enlightening. Delving into the 12 steps has given me a new perspective on my recovery journey. The group's commitment to sobriety is truly inspiring. Solid 5 stars!"}
]

Insert cell
Insert cell
client = DuckDBClient.of({
meetings: FileAttachment("AA_Data_Final.csv"),
reviews: reviewData
})
Insert cell
client
Insert cell
client
SELECT column00, "group_name", Day, "start_time", "address_clean","wheelchair_access", "special_interest", "day", "meeting_type", "review_text", "username", "start_hr_24"
FROM meetings
LEFT OUTER JOIN reviews ON meetings.column00 = reviews.review_id
ORDER BY column00;
Insert cell
client
SELECT
meetings.*,
reviews.*
FROM
meetings
LEFT OUTER JOIN
reviews
ON
meetings.column00 = reviews.review_id;
Insert cell
Insert cell
client
SELECT *
FROM meetings
WHERE day = ${d} AND meetings."start_hr_24" = ${st};

Insert cell
client
SELECT start_hr_24
FROM meetings

Insert cell
d
Insert cell
st
Insert cell
daysQuery
Insert cell
Insert cell
d
Insert cell
viewof d = Inputs.select(days, {label: "Select Day"});

Insert cell
viewof st = Inputs.range([1,24],{step:1}, {label: "Select Start Time"})
Insert cell
Insert cell
time = htl.html`The selected time is ${start_time[viewof st.value]}`
Insert cell
Insert cell


viewof map = {
const container = html`<div style="height:600px;">`;
yield container; // Give the container dimensions.
const map = container.value = new mapboxgl.Map({
container,
center: [-73.973103, 40.781031], // long lat in mapbox
zoom: 11,
style: "mapbox://styles/mapbox/light-v11",
scrollZoom: false
});

// Add zoom and rotation controls to the map.
map.addControl(new mapboxgl.NavigationControl());

const markers = [];

for (const element of daysQuery) {
const thisMarker = new mapboxgl.Marker()
.setLngLat([element.long, element.lat])
.addTo(map);

thisMarker.setPopup(new mapboxgl.Popup().setHTML(`
<h3>${element.group_name || ''}</h3>
<h4>${element.building_name || ''}</h4>
<p> ${element.address_clean}<br>
${element.day}, ${element.start_time}<br></p>
<p><b>Meeting Type:</b> ${element.meeting_type ? element.meeting_type : 'N/A'}</p>
<p><b>Wheelchair Access:</b> ${element.wheelchair_access ? element.wheelchair_access : 'N/A'}</p>
<p>${element.reviews || ''}</p>`)); //if null, show empty string
markers.push(thisMarker);
}
// // Zoom to the first marker
// if (markers.length > 0) {
// const firstMarkerLngLat = markers[0].getLngLat();
// map.flyTo({
// center: [firstMarkerLngLat.lng, firstMarkerLngLat.lat],
// zoom: 15,
// });
// }

invalidation.then(() => {
// Remove markers and popups on invalidation
for (const marker of markers) {
marker.remove();
}
map.remove(); // Remove the map as well
});
}
Insert cell
mapboxgl = {
const gl = await require("mapbox-gl@1");
if (!gl.accessToken) {
gl.accessToken = accessToken;
const href = await require.resolve("mapbox-gl@1/dist/mapbox-gl.css");
document.head.appendChild(html`<link href=${href} rel=stylesheet>`);
}
return gl;
} //doesn't need to change, keep this cell to run?
Insert cell
accessToken = "pk.eyJ1IjoibW9sbGllbWFyaWUiLCJhIjoiY2txNXF0Mmw5MTVvdDJ3b2N3bHhobXN6aCJ9.ztC4Av-WFMynvpwyFgUiGw"

Insert cell
days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
Insert cell
client
SELECT distinct "start_hr_24" AS times
FROM meetings
Insert cell
client
SELECT DISTINCT start_hr_24
FROM meetings
ORDER BY start_hr_24 DESC;
Insert cell
client
FROM meetings
SELECT DISTINCT meeting_type;
Insert cell
start_time = {
let starttime = [];
for (let i= 0; i <start_time_query.length; i++) {
starttime.push(start_time_query[i]["start_hr_24"]);
}
return starttime;
} //array of start time HOURS in 24-HR format
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more