Public
Edited
Jun 6, 2023
Insert cell
Insert cell
dec = FileAttachment("202212@2.xlsx").xlsx()
Insert cell
dec2 = sheet1.map((d) => ({...d, month: "December"}))
Insert cell
sheet1 = dec.sheet("Curie Coach Time Spent on Sleep")
Insert cell
dec1 = sheet1.map(d => ({Patient_ID: d.A, Date: d.B, Services: d.C, Time_Spent: d.D, Total_Time: d.E, Month: "December"}))
Insert cell
jan = FileAttachment("202301.xlsx").xlsx()
Insert cell
jan2 = sheet2.map((d) => ({...d, month: "January"}))
Insert cell
jan2.map((d) => ({
dates: d3.timeParse("%a %b %-d, %Y %H:%M %p")(jan2, (d) => d.C)
})
Insert cell
jan1 = sheet2.map(d => ({Patient_ID: d.B, Date: d[f(C)], Services: d.D, Time_Spent: d.E, Total_Time: d.F, Month: "January"}))
Insert cell
sheet2 = jan.sheet("Curie Coach Time Spent on Sleep")
Insert cell
feb = FileAttachment("202302.xlsx").xlsx()
Insert cell
feb2 = sheet3.map((d) => ({...d, month: "February"}))
Insert cell
sheet3 = feb.sheet("Curie Coach Time Spent on Sleep")
Insert cell
feb1 = feb2.map(d => ({Patient_ID: d.B, Date: d.C, Services: d.D, Time_Spent: d.E, Total_Time: d.F, Month: "February"}))

Insert cell
mar= FileAttachment("202303.xlsx").xlsx()
Insert cell
sheet4 = mar.sheet("Curie Coach Time Spent on Sleep")
Insert cell
mar2 = sheet4.map((d) => ({...d, month: "March"}))
Insert cell
mar1 = mar2.map(d => ({Patient_ID: d.B, Date: d.C, Services: d.D, Time_Spent: d.E, Total_Time: d.F, Month: "March"}))
Insert cell
apr = FileAttachment("202304.xlsx").xlsx()
Insert cell
sheet5 = apr.sheet("Curie Coach Time Spent on Sleep")
Insert cell
apr2 = sheet5.map((d) => ({...d, month: "April"}))
Insert cell
apr1 = apr2.map(d => ({Patient_ID: d.B, Date: d.C, Services: d.D, Time_Spent: d.E, Total_Time: d.F, Month: "April"}))
Insert cell
data1 = d3.merge([dec1, jan1, feb1, mar1, apr1])
Insert cell
data1
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
data1
X*
Y*
Color
Size
Facet X
Facet Y
Mark
Auto
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
removePatient = data.filter((d) => d.patientID)
Insert cell
import {Streamgraph} from "@d3/streamgraph"
Insert cell
chart = Streamgraph(data1, {
x: d => d.date,
y: d => d.time_spent,
z: d => d.patient_id,
yLabel: "Time Spent",
width,
height: 500
})
Insert cell
import {LineChart} from "@d3/line-chart"
Insert cell
flart = LineChart(data1, {
x: d => d.date,
y: d => d.time_spent,
yLabel: "Time Spent (min)",
width,
height: 500,
color: (d) => d.patient_id
})
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