Skip to content

Commit

Permalink
Iterate Dashboard (#2)
Browse files Browse the repository at this point in the history
* chore: update deps

* feat: 🚀 add devcontainer setup

* chore: add sample data loader

* docs: 🎨 update charts
  • Loading branch information
davidgasquez authored Oct 31, 2024
1 parent 37c003a commit 4b567d3
Show file tree
Hide file tree
Showing 7 changed files with 267 additions and 313 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Development Container",
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bookworm",
"postCreateCommand": "curl -L https://github.com/duckdb/duckdb/releases/download/v1.1.2/duckdb_cli-linux-amd64.zip -o duckdb.zip && unzip -o duckdb.zip && chmod +x duckdb && mkdir -p ~/.local/bin && mv -f duckdb ~/.local/bin/ && rm duckdb.zip",
"postCreateCommand": "curl -L https://github.com/duckdb/duckdb/releases/download/v1.1.2/duckdb_cli-linux-amd64.zip -o duckdb.zip && unzip -o duckdb.zip && chmod +x duckdb && mkdir -p ~/.local/bin && mv -f duckdb ~/.local/bin/ && rm duckdb.zip"
}
367 changes: 179 additions & 188 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 10 additions & 7 deletions src/data/[provider]_daily_metrics.csv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ if [ ! -f "$TMPDIR/storage_providers_metrics.parquet" ]; then
onboarded_data_tibs,
deals,
raw_power_pibs,
quality_adjusted_power_pibs
quality_adjusted_power_pibs,
-- Spark Retrieval Metrics
-- total_retrieval_requests,
-- successful_retrieval_requests,
-- Sector Events
sector_added_events_count,
sector_faulted_events_count,
FROM read_parquet('https://data.filecoindataportal.xyz/filecoin_daily_storage_providers_metrics.parquet')
WHERE date >= CURRENT_DATE() - INTERVAL '90 days'
ORDER BY date desc
Expand All @@ -28,12 +36,7 @@ duckdb :memory: << EOF
SET enable_progress_bar = false;
COPY (
SELECT
date,
provider_id,
onboarded_data_tibs,
deals,
raw_power_pibs,
quality_adjusted_power_pibs
*
FROM '$TMPDIR/storage_providers_metrics.parquet'
WHERE provider_id = '${provider}'
ORDER BY date desc
Expand Down
21 changes: 21 additions & 0 deletions src/data/sample_data_ts_duckdb.csv.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Database } from "duckdb-async";


const db = await Database.create(":memory:");
const rows = await db.all(`
SELECT
cast(date as string) as date,
unique_deal_making_providers,
providers_with_active_deals,
providers_with_power,
FROM read_parquet('https://data.filecoindataportal.xyz/filecoin_daily_metrics.parquet')
WHERE date >= CURRENT_DATE() - INTERVAL '90 days'
`);

// Convert rows to CSV format
const headers = Object.keys(rows[0]).join(',');
const csvRows = rows.map(row => Object.values(row).join(','));
const csvContent = [headers, ...csvRows].join('\n');

// Write to stdout
console.log(csvContent);
10 changes: 5 additions & 5 deletions src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ This is an aggregate view looking at all Storage Providers on the network.

```js
resize((width) => Plot.plot(addPlotCaption({
title: "Providers Making Onchain Deals",
subtitle: "On a given day, how many providers made an online deal.",
title: "Providers Making State Market Deals",
subtitle: "On a given day, how many providers made a state market deal.",
x: {label: "Date"},
y: {grid: true, label: "Providers"},
width,
Expand All @@ -68,8 +68,8 @@ This is an aggregate view looking at all Storage Providers on the network.

```js
resize((width) => Plot.plot(addPlotCaption({
title: "Providers With Active Deals",
subtitle: "How many providers have active deals.",
title: "Providers With Active State Market Deals",
subtitle: "How many providers have active state market deals.",
x: { label: "Date" },
y: { grid: true, label: "Providers", zero: true },
width,
Expand All @@ -91,7 +91,7 @@ This is an aggregate view looking at all Storage Providers on the network.
```js
resize((width) => Plot.plot(addPlotCaption({
title: "Providers With Power",
subtitle: "How many providers are with power.",
subtitle: "How many providers have power in the network.",
x: { label: "Date" },
y: { grid: true, label: "Providers", zero: true },
width,
Expand Down
56 changes: 51 additions & 5 deletions src/provider/[provider].md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const provider_metrics = FileAttachment(`../data/${observable.params.provider}_d

```js
resize((width) => Plot.plot({
title: "Onboarded Data",
caption: "Data onboarded in TiB",
title: "State Market Deals Data Onboarding",
subtitle: "Data onboarded via state market deals",
x: {label: "Date"},
y: {grid: true, label: "TiB"},
y: {grid: true, label: "TiBs"},
width,
marks: [
Plot.ruleY([0]),
Expand All @@ -36,8 +36,8 @@ const provider_metrics = FileAttachment(`../data/${observable.params.provider}_d

```js
resize((width) => Plot.plot({
title: "Deals",
caption: "Showing only State Market deals",
title: "State Market Deals",
subtitle: "Showing only State Market deals",
x: {label: "Date"},
y: {grid: true, label: "Deals"},
width,
Expand Down Expand Up @@ -94,5 +94,51 @@ const provider_metrics = FileAttachment(`../data/${observable.params.provider}_d
}))
```
</div>
</div>


<div class="grid grid-cols-2">
<div class="card">

```js
resize((width) => Plot.plot({
title: "Sector Added Events",
caption: "Number of sector added events",
x: {label: "Date"},
y: {grid: true, label: "Count"},
width,
marks: [
Plot.ruleY([0]),
Plot.rectY(provider_metrics, {
x: "date",
y: "sector_added_events_count",
tip: true,
interval: "day"
})
]
}))
```
</div>

<div class="card">

```js
resize((width) => Plot.plot({
title: "Sector Faulted Events",
caption: "Number of sector faulted events",
x: {label: "Date"},
y: {grid: true, label: "Count"},
width,
marks: [
Plot.ruleY([0]),
Plot.rectY(provider_metrics, {
x: "date",
y: "sector_faulted_events_count",
tip: true,
interval: "day"
})
]
}))
```
</div>
</div>
107 changes: 0 additions & 107 deletions src/provider/[provider]_ddb.md

This file was deleted.

0 comments on commit 4b567d3

Please sign in to comment.