File size: 3,256 Bytes
11ccf60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32fa7e5
11ccf60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
from pathlib import Path
import pandas as pd
import requests
import json


def infer_split(name):
    name = name.lower()
    if "train" in name:
        return "train"
    if "val" in name or "validation" in name:
        return "validation"
    if "test" in name:
        return "test"
    return "unspecified"


repo = Path(".").resolve()

xyz_dir = repo / "xyz"
h5_dir = repo / "h5"

rows = []

for xyz_file in sorted(xyz_dir.glob("*.xyz")):
    sample_id = xyz_file.stem
    h5_file = h5_dir / f"{sample_id}.h5"

    rows.append({
        "id": sample_id,
        "xyz_path": str(xyz_file.relative_to(repo)),
        "h5_path": str(h5_file.relative_to(repo)) if h5_file.exists() else None,
        "split": infer_split(sample_id),
    })

df = pd.DataFrame(rows)

print(df)
print(f"Rows: {len(df)}")

df.to_parquet("metadata.parquet", index=False)


# --- Fetch Croissant metadata from Hugging Face ---
url = "https://huggingface.co/api/datasets/CatalystAnonymous/catalyst_mxenes/croissant"
response = requests.get(url)
response.raise_for_status()
data = response.json()


# --- Get dataset node ---
# Croissant can either be a single Dataset node or use @graph.
if "@graph" in data:
    dataset_node = data["@graph"][0]
else:
    dataset_node = data


# --- Update general dataset description ---
dataset_node["description"] = (
    "Dataset associated with the article: Benchmark Dataset for Catalysis on 2D MXenes. "
    "The dataset contains computational catalyst data for MXene structures, including "
    "first-principles simulation results intended for machine learning benchmarks."
)


# --- Inject Responsible AI metadata ---
dataset_node["rai:dataLimitations"] = (
    "The dataset is limited to adsorption on MXenes with a Ti$_2$C backbone, "
    "terminated by O and/or OH groups at varying surface coverages. "
    "The considered chemical reactions are restricted to those involving CO$_2$, H$_2$, H$_2$O, "
    "and HCOOH, including adsorbed reaction intermediates such as HCOO$^-$ and COOH$^-$. "
)

dataset_node["rai:dataBiases"] = (
    "The dataset reflects the sampling strategy, structural prototypes, adsorbate choices, "
    "simulation settings, and preprocessing choices used during construction. This may bias "
    "models toward the represented MXene compositions, surface configurations, and "
    "first-principles calculation conditions."
)

dataset_node["rai:personalSensitiveInformation"] = (
    "The dataset does not contain personal or sensitive information."
)

dataset_node["rai:dataUseCases"] = (
    "Intended for benchmarking and developing machine learning models for catalysis on "
    "2D MXenes, "
    "learning from first-principles simulation data."
)

dataset_node["rai:dataSocialImpact"] = (
    "The dataset may support catalyst discovery and materials science research. Misuse "
    "could include applying trained models outside the domain covered by the simulations "
    "or interpreting predictions as experimentally validated results."
)

dataset_node["rai:hasSyntheticData"] = True


# --- Save updated Croissant metadata ---
with open("croissant.json", "w", encoding="utf-8") as f:
    json.dump(data, f, indent=2, ensure_ascii=False)

print("Saved croissant.json with updated RAI metadata")