openmindat


Nameopenmindat JSON
Version 0.0.7 PyPI version JSON
download
home_pagehttps://github.com/ChuBL/OpenMindat
SummaryAn alpha version for OpenMindat package
upload_time2024-04-26 22:38:50
maintainerNone
docs_urlNone
authorJiyin Zhang
requires_pythonNone
licenseApache Software License
keywords mindat openmindat mineral data python api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # OpenMindat Python Package

This is a test version of the OpenMindat Python package, designed to facilitate querying and retrieving data on minerals and geomaterials from the Mindat API. It provides classes for detailed queries based on various attributes like IMA status, keywords, and specific geomaterial properties.

GitHub Repository: [OpenMindat Python Package](https://github.com/ChuBL/OpenMindat)

## Get Started

### Install via Pip

```console
foo@bar:~$ pip install openmindat
```

### Import the Package in Python

```python
import openmindat
```

## Use Cases

### 0. Setting API Key in Alternative Ways

```python
import os

os.environ["MINDAT_API_KEY"] = 'Your_Mindat_API_Key'
```

> If you do not have a Mindat API key, please refer to [How to Get My Mindat API Key or Token?](https://www.mindat.org/a/how_to_get_my_mindat_api_key)

You can also set the API key by following the general queries.

### 1. Perform Detailed Queries on Geomaterials

```python
from openmindat import GeomaterialRetriever

gr = GeomaterialRetriever()
gr.density_min(2.0).density_max(5.0).crystal_system("Hexagonal")
gr.elements_exc("Au,Ag")
gr.save()
```

### 2. Retrieve IMA-Approved Minerals

```python
from openmindat import MineralsIMARetriever

mir = MineralsIMARetriever()
mir.fields("id,name,ima_formula,ima_year")
mir.saveto("./mindat_data", 'my_filename')
```

### 3. Search Geomaterials Using Keywords

```python
from openmindat import GeomaterialSearchRetriever

gsr = GeomaterialSearchRetriever()
gsr.geomaterials_search("quartz, green, hexagonal")
gsr.save("filename")

# Alternatively, you can get the list object directly:
gsr = GeomaterialSearchRetriever()
gsr.geomaterials_search("ruby, red, hexagonal")
print(gsr.get_dict())
```

### 4. Retrieve Localities

```python
from openmindat import LocalitiesRetriever

lr = LocalitiesRetriever()
lr.country("UK").txt("mine")
lr.save()

# Alternatively, you can get the list object directly:
lr = LocalitiesRetriever()
lr.country("Canada").description("mine")
print(lr.get_dict())
```

### 5. Retrieve Type Localities for IMA-Approved Mineral Species

```python
from openmindat import GeomaterialRetriever

gr = GeomaterialRetriever()
gr.ima(True).expand("type_localities")
gr.saveto("./mindat_data")
```

### 6. Retrieve Locality Occurrences for Single Mineral Species
Please consider using only one mineral species ID for querying localities occurrences since this query might result in many records and exceed the server limitation.

```python
from openmindat import GeomaterialRetriever

gr = GeomaterialRetriever()
gr.expand("locality").id__in(str(id_value))
gr.saveto("./mindat_data")
```

## Documentation

- **GitHub Wiki**: For comprehensive documentation, visit our [GitHub Wiki](https://github.com/ChuBL/OpenMindat/wiki).

- **OpenMindat API Documentation**:
  [OpenMindat Redoc](https://api.mindat.org/schema/redoc/)

- **Built-in Help**:

To explore detailed class and method documentation within the OpenMindat package, use Python's built-in `help()` function. This provides direct access to docstrings, showcasing usage examples and parameter details. Example:

```python
from openmindat import GeomaterialRetriever

help(GeomaterialRetriever)
```

The help() is also available for the specific functions:

```python
>>> from openmindat import MineralsIMARetriever

>>> help(MineralsIMARetriever.fields)
```

Press `q` to exit the help interface.



### Contact Us

For further assistance or feedback, feel free to contact the development team at [jiyinz@uidaho.edu](mailto:jiyinz@uidaho.edu).


## License

**Project Licence:** [Apache](LICENSE)

**Mindat Data License:** [CC BY-NC-SA 4.0 DEED](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)

The Mindat API is currently in beta test, and while access is free for all, please note that the data provided are not yet licensed for redistribution and are for private, non-commercial use only. Once launched, data will be available under an open-access license, but please always check the terms of use of the license before reusing these data.

## Author

Jiyin Zhang, Cory Clairmont, Xiaogang Ma

## Acknowledgments

<p float="left">
        <img src="https://github.com/ChuBL/OpenMindat/blob/main/Logo/mindat2017.png?raw=true"  width="25%">
        <img src="https://github.com/ChuBL/OpenMindat/blob/main/Logo/NSF_Official_logo_Low_Res.png?raw=true"  width="10%">
</p>

- This work is supported by NSF, Award #2126315.

## Upgrading Logs

### 0.0.7
**Released:** Apr 26, 2024

- The Locality country filter is fixed. The endpoint can download the data for specific countries, e.g., 'UK', 'USA', etc.

### 0.0.6
**Released:** Apr 26, 2024

- Revised a neglected get function for country endpoints.

### 0.0.5
**Released:** Apr 26, 2024

- The `Internal Server Error` issue in v0.0.4 is fixed from the server side.
- The get functions are now changed to `get_dict`.
- Added progress bars for multiple-page queries.
- Some other minor updates.


### 0.0.4
**Released:** Apr 14, 2024

- Tentative issue: Data queries involving multiple pages might return an `Internal Server Error` due to server-end issues. [Related GitHub issue](https://github.com/ChuBL/OpenMindat/issues/12)
- Added support to getting list objects of obtained data in addition to saving it to local directories.

### 0.0.3
**Released:** Apr 11, 2024

- Tentative issue: Data queries involving multiple pages might return an `Internal Server Error` due to server-end issues. 
- Now supporting more Mindat endpoints. Not fully tested. Feedback is welcome.
- Revised API key obtaining workflow.

### 0.0.1
**Released:** Dec 14, 2023

- Initial release of the package.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ChuBL/OpenMindat",
    "name": "openmindat",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "mindat openmindat mineral data python api",
    "author": "Jiyin Zhang",
    "author_email": "jiyinz@uidaho.edu",
    "download_url": "https://files.pythonhosted.org/packages/b1/19/2590338b02ebd771f38550abca75d76a1680a0cca8627e1b8e588414866c/openmindat-0.0.7.tar.gz",
    "platform": null,
    "description": "# OpenMindat Python Package\n\nThis is a test version of the OpenMindat Python package, designed to facilitate querying and retrieving data on minerals and geomaterials from the Mindat API. It provides classes for detailed queries based on various attributes like IMA status, keywords, and specific geomaterial properties.\n\nGitHub Repository: [OpenMindat Python Package](https://github.com/ChuBL/OpenMindat)\n\n## Get Started\n\n### Install via Pip\n\n```console\nfoo@bar:~$ pip install openmindat\n```\n\n### Import the Package in Python\n\n```python\nimport openmindat\n```\n\n## Use Cases\n\n### 0. Setting API Key in Alternative Ways\n\n```python\nimport os\n\nos.environ[\"MINDAT_API_KEY\"] = 'Your_Mindat_API_Key'\n```\n\n> If you do not have a Mindat API key, please refer to [How to Get My Mindat API Key or Token?](https://www.mindat.org/a/how_to_get_my_mindat_api_key)\n\nYou can also set the API key by following the general queries.\n\n### 1. Perform Detailed Queries on Geomaterials\n\n```python\nfrom openmindat import GeomaterialRetriever\n\ngr = GeomaterialRetriever()\ngr.density_min(2.0).density_max(5.0).crystal_system(\"Hexagonal\")\ngr.elements_exc(\"Au,Ag\")\ngr.save()\n```\n\n### 2. Retrieve IMA-Approved Minerals\n\n```python\nfrom openmindat import MineralsIMARetriever\n\nmir = MineralsIMARetriever()\nmir.fields(\"id,name,ima_formula,ima_year\")\nmir.saveto(\"./mindat_data\", 'my_filename')\n```\n\n### 3. Search Geomaterials Using Keywords\n\n```python\nfrom openmindat import GeomaterialSearchRetriever\n\ngsr = GeomaterialSearchRetriever()\ngsr.geomaterials_search(\"quartz, green, hexagonal\")\ngsr.save(\"filename\")\n\n# Alternatively, you can get the list object directly:\ngsr = GeomaterialSearchRetriever()\ngsr.geomaterials_search(\"ruby, red, hexagonal\")\nprint(gsr.get_dict())\n```\n\n### 4. Retrieve Localities\n\n```python\nfrom openmindat import LocalitiesRetriever\n\nlr = LocalitiesRetriever()\nlr.country(\"UK\").txt(\"mine\")\nlr.save()\n\n# Alternatively, you can get the list object directly:\nlr = LocalitiesRetriever()\nlr.country(\"Canada\").description(\"mine\")\nprint(lr.get_dict())\n```\n\n### 5. Retrieve Type Localities for IMA-Approved Mineral Species\n\n```python\nfrom openmindat import GeomaterialRetriever\n\ngr = GeomaterialRetriever()\ngr.ima(True).expand(\"type_localities\")\ngr.saveto(\"./mindat_data\")\n```\n\n### 6. Retrieve Locality Occurrences for Single Mineral Species\nPlease consider using only one mineral species ID for querying localities occurrences since this query might result in many records and exceed the server limitation.\n\n```python\nfrom openmindat import GeomaterialRetriever\n\ngr = GeomaterialRetriever()\ngr.expand(\"locality\").id__in(str(id_value))\ngr.saveto(\"./mindat_data\")\n```\n\n## Documentation\n\n- **GitHub Wiki**: For comprehensive documentation, visit our [GitHub Wiki](https://github.com/ChuBL/OpenMindat/wiki).\n\n- **OpenMindat API Documentation**:\n  [OpenMindat Redoc](https://api.mindat.org/schema/redoc/)\n\n- **Built-in Help**:\n\nTo explore detailed class and method documentation within the OpenMindat package, use Python's built-in `help()` function. This provides direct access to docstrings, showcasing usage examples and parameter details. Example:\n\n```python\nfrom openmindat import GeomaterialRetriever\n\nhelp(GeomaterialRetriever)\n```\n\nThe help() is also available for the specific functions:\n\n```python\n>>> from openmindat import MineralsIMARetriever\n\n>>> help(MineralsIMARetriever.fields)\n```\n\nPress `q` to exit the help interface.\n\n\n\n### Contact Us\n\nFor further assistance or feedback, feel free to contact the development team at [jiyinz@uidaho.edu](mailto:jiyinz@uidaho.edu).\n\n\n## License\n\n**Project Licence:** [Apache](LICENSE)\n\n**Mindat Data License:** [CC BY-NC-SA 4.0 DEED](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)\n\nThe Mindat API is currently in beta test, and while access is free for all, please note that the data provided are not yet licensed for redistribution and are for private, non-commercial use only. Once launched, data will be available under an open-access license, but please always check the terms of use of the license before reusing these data.\n\n## Author\n\nJiyin Zhang, Cory Clairmont, Xiaogang Ma\n\n## Acknowledgments\n\n<p float=\"left\">\n        <img src=\"https://github.com/ChuBL/OpenMindat/blob/main/Logo/mindat2017.png?raw=true\"  width=\"25%\">\n        <img src=\"https://github.com/ChuBL/OpenMindat/blob/main/Logo/NSF_Official_logo_Low_Res.png?raw=true\"  width=\"10%\">\n</p>\n\n- This work is supported by NSF, Award #2126315.\n\n## Upgrading Logs\n\n### 0.0.7\n**Released:** Apr 26, 2024\n\n- The Locality country filter is fixed. The endpoint can download the data for specific countries, e.g., 'UK', 'USA', etc.\n\n### 0.0.6\n**Released:** Apr 26, 2024\n\n- Revised a neglected get function for country endpoints.\n\n### 0.0.5\n**Released:** Apr 26, 2024\n\n- The `Internal Server Error` issue in v0.0.4 is fixed from the server side.\n- The get functions are now changed to `get_dict`.\n- Added progress bars for multiple-page queries.\n- Some other minor updates.\n\n\n### 0.0.4\n**Released:** Apr 14, 2024\n\n- Tentative issue: Data queries involving multiple pages might return an `Internal Server Error` due to server-end issues. [Related GitHub issue](https://github.com/ChuBL/OpenMindat/issues/12)\n- Added support to getting list objects of obtained data in addition to saving it to local directories.\n\n### 0.0.3\n**Released:** Apr 11, 2024\n\n- Tentative issue: Data queries involving multiple pages might return an `Internal Server Error` due to server-end issues. \n- Now supporting more Mindat endpoints. Not fully tested. Feedback is welcome.\n- Revised API key obtaining workflow.\n\n### 0.0.1\n**Released:** Dec 14, 2023\n\n- Initial release of the package.\n",
    "bugtrack_url": null,
    "license": "Apache Software License",
    "summary": "An alpha version for OpenMindat package",
    "version": "0.0.7",
    "project_urls": {
        "Homepage": "https://github.com/ChuBL/OpenMindat"
    },
    "split_keywords": [
        "mindat",
        "openmindat",
        "mineral",
        "data",
        "python",
        "api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "44d93149b833fb545d49b1ade38921bb1a2c1efc42827331204c407fb414396a",
                "md5": "c582946eb0ddc724e60c5e31b3920e2c",
                "sha256": "dd17ec37ad42547580a4bd9be404107a5cc1efab5a9442640a5cfa49459a3236"
            },
            "downloads": -1,
            "filename": "openmindat-0.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c582946eb0ddc724e60c5e31b3920e2c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 44233,
            "upload_time": "2024-04-26T22:38:48",
            "upload_time_iso_8601": "2024-04-26T22:38:48.473309Z",
            "url": "https://files.pythonhosted.org/packages/44/d9/3149b833fb545d49b1ade38921bb1a2c1efc42827331204c407fb414396a/openmindat-0.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1192590338b02ebd771f38550abca75d76a1680a0cca8627e1b8e588414866c",
                "md5": "d0a5f95e061076054391ef563dc8644a",
                "sha256": "879c435bd9fc3caed265dd53c1869dcdfb9e7331ab7be64730846c045901ae31"
            },
            "downloads": -1,
            "filename": "openmindat-0.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "d0a5f95e061076054391ef563dc8644a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 33462,
            "upload_time": "2024-04-26T22:38:50",
            "upload_time_iso_8601": "2024-04-26T22:38:50.292276Z",
            "url": "https://files.pythonhosted.org/packages/b1/19/2590338b02ebd771f38550abca75d76a1680a0cca8627e1b8e588414866c/openmindat-0.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-26 22:38:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ChuBL",
    "github_project": "OpenMindat",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "openmindat"
}
        
Elapsed time: 0.23379s