endomorphosis commited on
Commit
fc00b77
·
verified ·
1 Parent(s): 006e490

Add README for state_admin_rules_cid schema and usage

Browse files
US_ADMINISTRATIVE_RULES/parsed/parquet/state_admin_rules_cid/README.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # US State Administrative Rules (CID-Keyed Parquet)
2
+
3
+ This folder contains a multi-state administrative-rules dataset exported as Parquet and indexed by IPFS content ID (`ipfs_cid`).
4
+
5
+ ## Snapshot
6
+ - Generated from canonical cleaned run: `canonical_merged_20260310_220852_cleaned_20260310_221150`
7
+ - States covered: 50
8
+ - Combined source rows: 1589
9
+ - Combined unique CIDs: 1589
10
+ - Source parquet files: 101 (50 per-state + 1 combined)
11
+ - Embeddings parquet files: 51 (50 per-state + 1 combined)
12
+ - Embedding model: `thenlper/gte-small`
13
+ - Embedding provider runtime: `embeddings_router` (`local_adapter`)
14
+
15
+ ## Source Parquet Schema
16
+ Primary key column (CID-first ordering):
17
+ - `ipfs_cid`
18
+ - `state_code`
19
+ - `source_id`
20
+ - `identifier`
21
+ - `name`
22
+ - `legislation_type`
23
+ - `legislation_jurisdiction`
24
+ - `source_url`
25
+ - `text`
26
+ - `jsonld`
27
+
28
+ ## Embeddings Parquet Schema
29
+ Primary key column (CID-first ordering):
30
+ - `ipfs_cid`
31
+ - `state_code`
32
+ - `semantic_text`
33
+ - `embedding_model`
34
+ - `embedding`
35
+
36
+ Semantic embedding input was restricted to semantic text columns:
37
+ - `name`
38
+ - `text`
39
+
40
+ ## Manifests
41
+ - `manifest.parquet.json`: source conversion stats and per-state row counts
42
+ - `embeddings_manifest.json`: embeddings build stats and per-file summaries
43
+
44
+ ## Quick Query Examples
45
+ ### DuckDB: inspect source rows
46
+ ```sql
47
+ SELECT state_code, identifier, name
48
+ FROM read_parquet('state_admin_rules_all_states.parquet')
49
+ WHERE ipfs_cid IS NOT NULL
50
+ LIMIT 20;
51
+ ```
52
+
53
+ ### DuckDB: join source with embeddings on CID
54
+ ```sql
55
+ SELECT s.state_code, s.identifier, s.name, e.embedding_model
56
+ FROM read_parquet('state_admin_rules_all_states.parquet') s
57
+ JOIN read_parquet('state_admin_rules_all_states_embeddings.parquet') e
58
+ ON s.ipfs_cid = e.ipfs_cid
59
+ LIMIT 20;
60
+ ```
61
+
62
+ ### Python: load one state
63
+ ```python
64
+ import pyarrow.parquet as pq
65
+
66
+ table = pq.read_table('STATE-CA.parquet')
67
+ print(table.num_rows, table.column_names)
68
+ ```