Skip to content

Commit 2802d4e

Browse files
nmwashtonclaude
andcommitted
Add MindatLoader for Mindat.org mineralogical database access
Adds a new loader class for querying and caching mineral data from the Mindat API via the openmindat Python package. Features include: - Fetch minerals by element, name, or ID - Query IMA-approved minerals - Fetch locality data for minerals - Support for all DOE critical mineral elements - Predefined element groups (REE, PGM, battery metals, etc.) - Local caching of API results for offline access Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7f34933 commit 2802d4e

4 files changed

Lines changed: 669 additions & 2 deletions

File tree

src/cmm_data/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ def __getattr__(name):
3535
elif name == "OECDSupplyChainLoader":
3636
from .loaders.oecd_supply import OECDSupplyChainLoader
3737
return OECDSupplyChainLoader
38+
elif name == "MindatLoader":
39+
from .loaders.mindat import MindatLoader
40+
return MindatLoader
3841
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
3942

4043

@@ -126,6 +129,7 @@ def iter_corpus_documents(**kwargs):
126129
"GAChronostratigraphicLoader",
127130
"NETLREECoalLoader",
128131
"OECDSupplyChainLoader",
132+
"MindatLoader",
129133
# Convenience functions
130134
"load_usgs_commodity",
131135
"load_ore_deposits",

src/cmm_data/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class CMMDataConfig:
6464
ga_chronostrat_dir: str = "GA_149923_Chronostratigraphic"
6565
netl_ree_dir: str = "NETL_REE_Coal"
6666
oecd_supply_dir: str = "OECD_Supply_Chain_Data"
67+
mindat_dir: str = "Mindat"
6768

6869
# Caching settings
6970
cache_enabled: bool = True
@@ -98,6 +99,7 @@ def get_path(self, dataset: str) -> Path:
9899
"netl": self.netl_ree_dir,
99100
"netl_ree": self.netl_ree_dir,
100101
"oecd": self.oecd_supply_dir,
102+
"mindat": self.mindat_dir,
101103
}
102104

103105
rel_path = path_map.get(dataset.lower())
@@ -115,7 +117,7 @@ def validate(self) -> dict:
115117
"""
116118
datasets = [
117119
"usgs_commodity", "usgs_ore", "osti", "preprocessed",
118-
"ga_chronostrat", "netl_ree", "oecd"
120+
"ga_chronostrat", "netl_ree", "oecd", "mindat"
119121
]
120122

121123
status = {}

src/cmm_data/loaders/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
"""Data loaders for CMM datasets."""
22

33
from .base import BaseLoader
4+
from .mindat import MindatLoader, CRITICAL_ELEMENTS, ELEMENT_GROUPS
45

5-
__all__ = ["BaseLoader"]
6+
__all__ = [
7+
"BaseLoader",
8+
"MindatLoader",
9+
"CRITICAL_ELEMENTS",
10+
"ELEMENT_GROUPS",
11+
]

0 commit comments

Comments
 (0)