How lmmentel/mendeleev works
Main Components
• Core API Library: Represent the “mendeleev” package’s main modules. This node should include the “mendeleev” folder with submodules such as:
• Core logic (e.g., mendeleev/__init__.py, mendeleev/mendeleev.py)
• Data access (e.g., mendeleev/db.py and mendeleev/fetch.py)
• Special utilities (mendeleev/utils.py)
• Element-specific, ion, and isotope functionality (mendeleev/ion.py and mendeleev/models.py)
• Visualization Layer: Emphasize the “vis” submodule (mendeleev/vis/*) that provides visualization functions using Bokeh, Plotly, and Seaborn. This component connects with the core API to render periodic table visualizations.
• Interfaces to External Data: Include separate components representing external interfaces (located in mendeleev/interfaces/) such as NIST ASD and Wikipedia oxidation states. This shows how the system interacts with external data sources.
• Database & Data Migrations: Represent the database component. Include the Alembic migration system (alembic folder along with the alembic.ini configuration) and a reference to the “elements.db” file if applicable. This illustrates how the project manages schema evolution and persists data.
• Command Line Interface (CLI): Include the CLI module (mendeleev/cli.py and the related tests) which serves as an entry point to consume the core functionalities directly from the terminal.
• Interactive Web Application: Even if not part of the codebase per se, the README describes an interactive web app (deployed, for example, on Heroku) that serves as a frontend for exploring the data. Include this as an external consumer of the API.
Relationships and Data Flow
• The Core API should be shown interacting with the Database and managing data migrations (using Alembic).
• The external interfaces (NIST_ASD, wiki oxidation states) feed data into the core system.
• Visualizations receive processed data from the API and pass on rendered content to end-users (or the web app front end).
Architectural Patterns and Design Principles
• Modular Architecture: Separate modules for data retrieval, data modeling, and visualization.
• Layered Design: Distinct layers for data (database), business logic (core API and models), presentation (CLI, web app, and visualization modules), and external integrations (interfaces).
• Emphasis on Extensibility: Extensible interfaces for additional data sources (as evidenced by the “interfaces” subdirectory), which allows the system to grow.
• Testing and Documentation: Robust tests and detailed documentation indicate a commitment to maintainability and reliability.
Technologies, Frameworks, and Libraries
• Pandas: Integration for data manipulation is mentioned.
• Bokeh, Plotly, Seaborn: As visualization libraries.
• Alembic: For database migrations with a possible backend database (likely SQLite or another RDBMS).
• Command line scripts using standard Python CLI techniques.
• External Data Interfaces might rely on HTTP libraries or other parsing utilities.