Skip to content

Commit

Permalink
Update observable
Browse files Browse the repository at this point in the history
  • Loading branch information
mfortini committed Aug 6, 2024
1 parent c3da884 commit 75f397c
Show file tree
Hide file tree
Showing 3 changed files with 1,130 additions and 573 deletions.
10 changes: 6 additions & 4 deletions observable/carbonEnti/docs/data/entiRes.parquet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ filename2=/tmp/entiResIPA.parquet
url_2022_02_11=https://raw.githubusercontent.com/mfortini/carbonEnti/172024cc177ff57455460a9235b9fb4f96d32f2d/entiRes.csv
url_2023_11_02=https://raw.githubusercontent.com/mfortini/carbonEnti/ce5141b5f3b2db53bb50c7e08fd48a90468f9642/entiRes.csv
url_2024_03_12=https://raw.githubusercontent.com/mfortini/carbonEnti/98aec540827cbe1cc1684c8552d89d591e81c38a/entiRes.csv
url_2024_07_31=https://raw.githubusercontent.com/mfortini/carbonEnti/2923492daadf776b3de0fd78bc75f0cea6900433/entiRes.csv

url_IPA=https://raw.githubusercontent.com/mfortini/carbonEnti/main/enti.csv

duckdb -c "SET preserve_insertion_order=false;\
COPY (SELECT CAST ('2022-02-11' AS DATE) AS crawlDate ,* FROM read_csv_auto('${url_2022_02_11}')\
UNION SELECT CAST ('2023-11-02' AS DATE) AS crawlDate,* FROM read_csv_auto('${url_2023_11_02}')\
UNION SELECT CAST ('2024-03-12' AS DATE) AS crawlDate,* FROM read_csv_auto('${url_2024_03_12}'))\
COPY (SELECT CAST ('2022-02-11' AS DATE) AS crawlDate,*, NULL AS bootstrap2_js, NULL AS bootstrap2_css FROM read_csv_auto('${url_2022_02_11}') \
UNION SELECT CAST ('2023-11-02' AS DATE) AS crawlDate,*, NULL AS bootstrap2_js, NULL AS bootstrap2_css FROM read_csv_auto('${url_2023_11_02}') \
UNION SELECT CAST ('2024-03-12' AS DATE) AS crawlDate,*, NULL AS bootstrap2_js, NULL AS bootstrap2_css FROM read_csv_auto('${url_2024_03_12}') \
UNION SELECT CAST ('2024-07-31' AS DATE) AS crawlDate,* FROM read_csv_auto('${url_2024_07_31}')) \
TO '${filename}' (FORMAT 'PARQUET',CODEC 'ZSTD')"

duckdb -c "SET preserve_insertion_order=false;\
COPY (SELECT CAST (ER.crawlDate AS STRING) as crawlDate,\
ER.Codice_IPA, ER.url, ER.lightHouseScore,\
ER.firstMeaningfulPaint, ER.totalByteWeight, ER.bootstrap, ER.bootstrapItalia,\
ER.firstMeaningfulPaint, ER.totalByteWeight, ER.bootstrap, ER.bootstrapItalia, ER.bootstrap2_js, regexp_extract(ER.bootstrap2_css, '.*"\(\S\)".*') as bootstrap2_js, \
IPA.Denominazione_ente, IPA.Codice_comune_ISTAT FROM read_parquet('${filename}') ER JOIN read_csv_auto('${url_IPA}') IPA ON ER.Codice_IPA = IPA.Codice_IPA)\
TO '${filename2}' (FORMAT 'PARQUET',CODEC 'ZSTD')"

Expand Down
2 changes: 1 addition & 1 deletion observable/carbonEnti/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Lighthouse è stato fatto girare su tutti i siti dei comuni italiani presenti su
## In quanti enti è fallito Lighthouse?

```sql
SELECT CAST (crawlDate AS STRING) as crawlDate, COUNT(Codice_IPA) FROM entiRes where lighthouseScore = 0 GROUP BY crawlDate ORDER BY crawlDate
SELECT CAST (crawlDate AS STRING) as crawlDate, COUNT(Codice_IPA) FROM entiRes where lighthouseScore = 0 OR lighthouseScore IS NULL GROUP BY crawlDate ORDER BY crawlDate
```

## Quanti hanno risposto in HTTPS?
Expand Down
Loading

0 comments on commit 75f397c

Please sign in to comment.