massomo commited on
Commit
323ff68
·
1 Parent(s): cf1e2c0

Fix dataset structure for proper HF viewer display

Browse files

- Added dataset loading script (abscorrespondance.py)
- Created data/train.parquet with 95,674 master correspondence records
- Removed branch_catchments files that confused the viewer
- Added dataset_info.json for metadata

Now the full 95,674-record master correspondence table should display properly.

abscorrespondance.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Australian Geographic Correspondence Table dataset."""
2
+
3
+ import datasets
4
+ import pandas as pd
5
+
6
+ _DESCRIPTION = """
7
+ A comprehensive correspondence table linking Australian geographic hierarchies (POA ↔ LGA ↔ SA2 ↔ Branch Catchments)
8
+ built using real Australian Bureau of Statistics (ABS) data. Contains 95,674 records with spatial intersection weights.
9
+ """
10
+
11
+ _HOMEPAGE = "https://github.com/Mrassimo/HCFcorrtable"
12
+
13
+ _LICENSE = "MIT"
14
+
15
+ _URLS = {
16
+ "train": "master_correspondence_table.parquet",
17
+ }
18
+
19
+
20
+ class ABSCorrespondance(datasets.GeneratorBasedBuilder):
21
+ """Australian Geographic Correspondence Table dataset."""
22
+
23
+ VERSION = datasets.Version("1.0.0")
24
+
25
+ def _info(self):
26
+ features = datasets.Features({
27
+ "poa_code": datasets.Value("string"),
28
+ "poa_name": datasets.Value("int64"),
29
+ "lga_code": datasets.Value("string"),
30
+ "lga_name": datasets.Value("string"),
31
+ "sa2_code": datasets.Value("string"),
32
+ "sa2_name": datasets.Value("string"),
33
+ "branch_id": datasets.Value("string"),
34
+ "branch_name": datasets.Value("string"),
35
+ "branch_type": datasets.Value("string"),
36
+ "branch_lat": datasets.Value("float64"),
37
+ "branch_long": datasets.Value("float64"),
38
+ "poa_to_lga_weight": datasets.Value("float64"),
39
+ "lga_to_sa2_weight": datasets.Value("float64"),
40
+ "catchment_overlap_pct": datasets.Value("float64"),
41
+ "distance_to_branch_km": datasets.Value("float64"),
42
+ "record_type": datasets.Value("string"),
43
+ })
44
+
45
+ return datasets.DatasetInfo(
46
+ description=_DESCRIPTION,
47
+ features=features,
48
+ homepage=_HOMEPAGE,
49
+ license=_LICENSE,
50
+ )
51
+
52
+ def _split_generators(self, dl_manager):
53
+ urls = _URLS
54
+ data_path = dl_manager.download(urls["train"])
55
+
56
+ return [
57
+ datasets.SplitGenerator(
58
+ name=datasets.Split.TRAIN,
59
+ gen_kwargs={
60
+ "filepath": data_path,
61
+ },
62
+ ),
63
+ ]
64
+
65
+ def _generate_examples(self, filepath):
66
+ """Yields examples from the dataset."""
67
+ df = pd.read_parquet(filepath)
68
+
69
+ for idx, row in df.iterrows():
70
+ yield idx, row.to_dict()
branch_catchments.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:e671cd29e6ab78e6c8ddaf7e7bc1dfdc5be8847397838f870bfd335f9d71e3b2
3
- size 39183
 
 
 
 
branch_catchments.csv → data/train.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f4b29705cf5fe9451b5cf4a818f02b3eaa3a9fa5fcc685d0fa88fe226cd79900
3
- size 38512
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f6f2eb58ceba119bc399dbb758728f59bc17d9ccde1b636a83156923aa48e0db
3
+ size 277194
dataset_info.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dataset_name": "abscorrespondance",
3
+ "dataset_size": 95674,
4
+ "features": {
5
+ "poa_code": {
6
+ "dtype": "int64"
7
+ },
8
+ "poa_name": {
9
+ "dtype": "int64"
10
+ },
11
+ "lga_code": {
12
+ "dtype": "int64"
13
+ },
14
+ "lga_name": {
15
+ "dtype": "object"
16
+ },
17
+ "sa2_code": {
18
+ "dtype": "int64"
19
+ },
20
+ "sa2_name": {
21
+ "dtype": "object"
22
+ },
23
+ "branch_id": {
24
+ "dtype": "object"
25
+ },
26
+ "branch_name": {
27
+ "dtype": "object"
28
+ },
29
+ "branch_type": {
30
+ "dtype": "object"
31
+ },
32
+ "branch_lat": {
33
+ "dtype": "float64"
34
+ },
35
+ "branch_long": {
36
+ "dtype": "float64"
37
+ },
38
+ "poa_to_lga_weight": {
39
+ "dtype": "float64"
40
+ },
41
+ "lga_to_sa2_weight": {
42
+ "dtype": "float64"
43
+ },
44
+ "catchment_overlap_pct": {
45
+ "dtype": "float64"
46
+ },
47
+ "distance_to_branch_km": {
48
+ "dtype": "float64"
49
+ },
50
+ "record_type": {
51
+ "dtype": "object"
52
+ }
53
+ },
54
+ "splits": {
55
+ "train": {
56
+ "name": "train",
57
+ "num_examples": 95674,
58
+ "dataset_name": "abscorrespondance",
59
+ "data_files": [
60
+ "data/train.parquet"
61
+ ]
62
+ }
63
+ }
64
+ }