Compressed Data Dashboard
Decode embedded Gzip and ZIP fixtures, parse their CSV data, and turn the results into a request chart and error total. Both archives are real, so every module in this example executes while rendering the preview.

Complete app
app.star
load("compress/gzip.star", "gzip")
load("compress/zipfile.star", "zipfile")
load("encoding/base64.star", "base64")
load("encoding/csv.star", "csv")
load("humanize.star", "humanize")
load("render.star", "render")
TRAFFIC_GZIP = (
"H4sICGjzs2oAA3RyYWZmaWMuY3N2AAXBMQ6AMAwDwN1v8VAnBsKDKrGhtvT/3D3v" +
"npx97L6+hVZUod2MC2qMgMQ0FLSgZJ6Q6YIO2vgBNQmHjD4AAAA="
)
ERRORS_ZIP = (
"UEsDBBQAAAAIAFBVN12P5IIAJgAAACcAAAAKABwAZXJyb3JzLmNzdlVUCQADaPOz" +
"amjzs2p1eAsAAQT1AQAABAAAAAArTi0qy0xO1UktKsovKuZKLMjUMeYqSs1LSS3S" +
"MeRKSQVLGnEBAFBLAQIeAxQAAAAIAFBVN12P5IIAJgAAACcAAAAKABgAAAAAAAEA" +
"AACkgQAAAABlcnJvcnMuY3N2VVQFAANo87NqdXgLAAEE9QEAAAQAAAAAUEsFBgAA" +
"AAABAAEAUAAAAGoAAAAAAA=="
)
TRAFFIC_CSV = """hour,requests
08,18
09,27
10,22
11,34
12,41
13,36
14,48
15,44
"""
def main():
traffic_payload = gzip.decompress(base64.decode(TRAFFIC_GZIP))
traffic_rows = csv.read_all(TRAFFIC_CSV, skip = 1)
traffic = [float(row[1]) for row in traffic_rows]
points = [(index, value) for index, value in enumerate(traffic)]
archive = zipfile.ZipFile(base64.decode(ERRORS_ZIP))
error_source = archive.open("errors.csv").read()
error_rows = csv.read_all(error_source, skip = 1)
error_total = 0
for row in error_rows:
error_total += int(row[1])
return render.Root(
child = render.Padding(
pad = (0, 2, 2, 0),
child = render.Row(
children = [
render.Plot(
data = points,
width = 44,
height = 30,
color = "#38bdf8",
fill = True,
fill_color = "#0ea5e955",
x_lim = (0, len(points) - 1),
y_lim = (0, 50),
),
render.Box(width = 3, height = 1),
render.Column(
expanded = True,
main_align = "space_between",
children = [
render.Column(
children = [
render.Text("REQ", font = "CG-pixel-3x5-mono", color = "#94a3b8"),
render.Text(humanize.comma(int(traffic[-1])), color = "#f8fafc"),
],
),
render.Column(
children = [
render.Text("ERR %d" % error_total, font = "CG-pixel-3x5-mono", color = "#fb7185"),
render.Padding(
pad = (0, 1, 0, 1),
child = render.Text("%dB" % len(traffic_payload), font = "CG-pixel-3x5-mono", color = "#a7f3d0"),
),
],
),
],
),
],
),
),
)
How it works
base64.decode()restores each archive's binary data.gzip.decompress()expands the traffic fixture; its byte count is shown as62B.ZipFile.open()readserrors.csvdirectly as text forcsv.read_all().- The error rows are totaled, while traffic rows become
(x, y)plot points. humanize.comma()formats the latest request value before rendering.
Tetra's Gzip API returns bytes, not text. This sample keeps the matching CSV text beside the compressed fixture for parsing; ZIP entries are returned as text and can be parsed directly. For downloaded data, pass response bytes to the decompressor and use the decoded text representation supplied by your data source or archive API.