{"id":19274639,"url":"https://github.com/kjappelbaum/element-coder","last_synced_at":"2025-04-21T22:33:50.443Z","repository":{"id":36995456,"uuid":"502612149","full_name":"kjappelbaum/element-coder","owner":"kjappelbaum","description":"Encode chemical elements numerically and decode numerical representations of elements.","archived":false,"fork":false,"pushed_at":"2025-03-31T20:06:50.000Z","size":1092,"stargazers_count":9,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-18T21:10:04.256Z","etag":null,"topics":["chemical-elements","chemistry","decoding","encoding","hacktoberfest","pettifor"],"latest_commit_sha":null,"homepage":"https://element-coder.readthedocs.io/en/latest/?badge=latest","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kjappelbaum.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-12T12:38:58.000Z","updated_at":"2024-04-04T13:21:16.000Z","dependencies_parsed_at":"2023-11-13T22:23:00.704Z","dependency_job_id":"478d0699-56d5-46a0-9f85-7a4fabeacbf5","html_url":"https://github.com/kjappelbaum/element-coder","commit_stats":{"total_commits":54,"total_committers":2,"mean_commits":27.0,"dds":0.07407407407407407,"last_synced_commit":"9ce7021df5fd452f0b75084dfb617b2e27f41ae4"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjappelbaum%2Felement-coder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjappelbaum%2Felement-coder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjappelbaum%2Felement-coder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjappelbaum%2Felement-coder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kjappelbaum","download_url":"https://codeload.github.com/kjappelbaum/element-coder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250145655,"owners_count":21382461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chemical-elements","chemistry","decoding","encoding","hacktoberfest","pettifor"],"created_at":"2024-11-09T20:46:47.293Z","updated_at":"2025-04-21T22:33:49.422Z","avatar_url":"https://github.com/kjappelbaum.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/kjappelbaum/element-coder/raw/main/docs/source/logo.png\" height=\"150\"\u003e\n\u003c/p\u003e\n--\u003e\n\n\u003ch1 align=\"center\"\u003e\n  element_coder\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/kjappelbaum/element-coder/actions?query=workflow%3ATests\"\u003e\n        \u003cimg alt=\"Tests\" src=\"https://github.com/kjappelbaum/element-coder/workflows/Tests/badge.svg\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/cthoyt/cookiecutter-python-package\"\u003e\n        \u003cimg alt=\"Cookiecutter template from @cthoyt\" src=\"https://img.shields.io/badge/Cookiecutter-python--package-yellow\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/element_coder\"\u003e\n        \u003cimg alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/element_coder\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/element_coder\"\u003e\n        \u003cimg alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/element_coder\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/kjappelbaum/element-coder/blob/main/LICENSE\"\u003e\n        \u003cimg alt=\"PyPI - License\" src=\"https://img.shields.io/pypi/l/element_coder\" /\u003e\n    \u003c/a\u003e\n    \u003ca href='https://element_coder.readthedocs.io/en/latest/?badge=latest'\u003e\n        \u003cimg src='https://readthedocs.org/projects/element_coder/badge/?version=latest' alt='Documentation Status' /\u003e\n    \u003c/a\u003e\n    \u003ca href='https://github.com/psf/black'\u003e\n        \u003cimg src='https://img.shields.io/badge/code%20style-black-000000.svg' alt='Code style: black' /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nEncode chemical elements numerically and decode numerical representations of elements.\n\n## 💪 Getting Started\n\n```python\nfrom element_coder import encode, decode\n\ndecode(encode('Si', 'mod_pettifor'), 'mod_pettifor')\n\u003e'Si'\n```\n\n### Command Line Interface\n\nThe `element_coder.encode` and `element_coder.decode` command line tools are automatically installed. They can\nbe used from the shell with the `--help` flag to show help:\n\n```shell\n$ element_coder.encode H\n102\n```\n\n```shell\n$ element_coder.decode 102\nH\n```\n\nalso works for vector-valued encodings\n\n```shell\n$ element_coder.decode 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 --property cgcnn\nH\n```\n\n## 🚀 Installation\n\n\nThe most recent release can be installed from\n[PyPI](https://pypi.org/project/element_coder/) with:\n\n```bash\n$ pip install element_coder\n```\n\nThe most recent code and data can be installed directly from GitHub with:\n\n```bash\n$ pip install git+https://github.com/kjappelbaum/element-coder.git\n```\n\nTo install in development mode, use the following:\n\n```bash\n$ git clone git+https://github.com/kjappelbaum/element-coder.git\n$ cd element-coder\n$ pip install -e .\n```\n\n## Background\nFor some applications (of ML in chemistry) elements must be numerically encoded. There are many libraries that do that. For most applications, even [pymatgen](www.pymatgen.org) can get the job done:\n\n```python\nfrom pymatgen.core import Element\ndef encode_element(element: Element, property: str):\n    return getattr(element, property)\n```\n\nHowever, this code has some issues, wherefore there are many other libraries that attempt to solve this issue including [mendeleev](https://github.com/lmmentel/mendeleev), [elementy](https://github.com/Robert-Forrest/elementy), [EIMD](https://github.com/lrcfmd/ElMD). However,\n\n* none of these libraries supported all the properties I was interested in\n* none of these libraries supported decoding of descriptors into Elements.\n\n## 👐 Contributing\n\nContributions, whether filing an issue, making a pull request, or forking, are appreciated. See\n[CONTRIBUTING.rst](https://github.com/kjappelbaum/element-coder/blob/master/CONTRIBUTING.rst) for more information on getting involved.\n\n## 👋 Attribution\n\n### ⚖️ License\n\nThe code in this package is licensed under the MIT License.\n\n\u003c!--\n### 📖 Citation\n\nCitation goes here!\n--\u003e\n\n\u003c!--\n### 🎁 Support\n\nThis project has been supported by the following organizations (in alphabetical order):\n\n- [Harvard Program in Therapeutic Science - Laboratory of Systems Pharmacology](https://hits.harvard.edu/the-program/laboratory-of-systems-pharmacology/)\n\n--\u003e\n\n\u003c!--\n### 💰 Funding\n\nThis project has been supported by the following grants:\n\n| Funding Body | Program                                                                                                                       | Grant         |\n| ------------ | ----------------------------------------------------------------------------------------------------------------------------- | ------------- |\n| DARPA        | [Automating Scientific Knowledge Extraction (ASKE)](https://www.darpa.mil/program/automating-scientific-knowledge-extraction) | HR00111990009 |\n--\u003e\n\n### 🍪 Cookiecutter\n\nThis package was created with [@audreyfeldroy](https://github.com/audreyfeldroy)'s\n[cookiecutter](https://github.com/cookiecutter/cookiecutter) package using [@cthoyt](https://github.com/cthoyt)'s\n[cookiecutter-snekpack](https://github.com/cthoyt/cookiecutter-snekpack) template.\n\n## 🛠️ For Developers\n\n\u003cdetails\u003e\n  \u003csummary\u003eSee developer instrutions\u003c/summary\u003e\n\n\nThe final section of the README is for if you want to get involved by making a code contribution.\n\n### ❓ Testing\n\nAfter cloning the repository and installing `tox` with `pip install tox`, the unit tests in the `tests/` folder can be\nrun reproducibly with:\n\n```shell\n$ tox\n```\n\nAdditionally, these tests are automatically re-run with each commit in a [GitHub Action](https://github.com/kjappelbaum/element-coder/actions?query=workflow%3ATests).\n\n### 📦 Making a Release\n\nAfter installing the package in development mode and installing\n`tox` with `pip install tox`, the commands for making a new release are contained within the `finish` environment\nin `tox.ini`. Run the following from the shell:\n\n```shell\n$ tox -e finish\n```\n\nThis script does the following:\n\n1. Uses BumpVersion to switch the version number in the `setup.cfg` and\n   `src/element_coder/version.py` to not have the `-dev` suffix\n2. Packages the code in both a tar archive and a wheel\n3. Uploads to PyPI using `twine`. Be sure to have a `.pypirc` file configured to avoid the need for manual input at this\n   step\n4. Push to GitHub. You'll need to make a release going with the commit where the version was bumped.\n5. Bump the version to the next patch. If you made big changes and want to bump the version by minor, you can\n   use `tox -e bumpversion minor` after.\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkjappelbaum%2Felement-coder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkjappelbaum%2Felement-coder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkjappelbaum%2Felement-coder/lists"}