FlahaX
Plant-nutrient chemistry engine in Python: fertilizer formulation, aqueous equilibrium chemistry and auditable delivery planning.
FlahaX turns a crop's nutrient formula and the grower's actual water into a fertilizer recipe, then checks what that recipe does in solution: which ions pair up, whether anything precipitates, what the pH will be, how much acid reaches a target pH, and how the recipe splits into stock tanks and injector flows. Every plan carries its units, model identifiers and source hashes, so a result can be reviewed and reproduced.
To our knowledge, FlahaX is the first Python package to unite fertilizer formulation, fertilizer-specific aqueous equilibrium chemistry and auditable delivery planning in one dependency-free library, verified against PHREEQC.
Who it is for
- Researchers who need reproducible nutrient-solution chemistry with stated validity limits.
- Agronomists and consultants who design recipes against real water analyses and real commercial products.
- Growers with technical support, through the interactive command line.
- Developers building nutrition and fertigation software on a tested, dependency-free engine.
FlahaX and FlahaFAST. FlahaX is developed as the chemistry engine for the FlahaFAST application, where it is planned to provide formulation, pH and conductivity planning. That integration is not yet in place: FlahaFAST does not currently import FlahaX, and FlahaX stays a standalone package with its own releases.
Install
Python 3.11 or newer. There are no third-party runtime dependencies.
python -m pip install flahax==0.3.1
Pin the version for reproducible work. python -m pip install flahax
installs the latest release.
Quick start
Select salts for a crop formula, with 20 mg/L of calcium already in the water:
from flahax import load_library, recommend
result = recommend(
load_library()["salts"],
targets={"N_NO3": 128, "P": 58, "K": 211, "Ca": 104, "Mg": 40, "S": 54},
water={"Ca": 20},
)
for salt in result["salts"]:
print(f"{salt['name']}: {salt['gramsPerLitre']} g/L")
result["salts"] lists each chosen salt with grams per litre of the
solution the plant receives. result["rows"] gives each element's target,
final concentration (mg/L) and percentage difference. Element keys are
N_NO3, N_NH4, P, K, Ca, Mg, S, Fe, Mn, Zn, B, Cu
and Mo.
Command line
flahax --help
flahax workflow --interactive # water + crop targets -> recipe, pH and acid plan
flahax ec --interactive # approximate EC screening for supported products
flahax size --interactive # stock-channel volume and injector flow sizing
With no subcommand, flahax reads one JSON object (salts, targets,
water) on standard input and writes the recommendation as JSON. Commands
plan; they never operate pumps, valves or other hardware.
What it does
| Layer | Capability | Boundary |
|---|---|---|
| Formulation | Chooses salts and grams from the full shipped library to meet a fixed crop formula after subtracting the source water | Non-negative least squares; the formula is not altered |
| Equilibrium chemistry | One mixed aqueous model for all 28 catalogue products: 197 aqueous species, 28 solid phases, ion pairs, chelates and saturation indices | 25 °C, Davies activities up to ionic strength 0.1 mol/kg, fixed oxidation states, closed inorganic carbon |
| pH and acid | Calculated initial pH; nitric-acid dose to a target pH; standard workflow with nitric and phosphoric acid, using supplied assay and density | An initial dose estimate; measure after mixing |
| Delivery planning | Stock-tank grouping with compatibility and solubility checks, reagent volumes, pump and injector flow sizing, composed delivery plans | Uses caller-supplied product, compatibility and equipment records; no equipment model selection |
| Conductivity | Approximate EC screening for supported products; EC from a measured calibration profile | Dilute, pre-acid screening with unknown accuracy; no validated concentrated-stock model yet |
| Audit trail | Explicit units (g/L of final solution versus g/kg water), model identifiers, source hashes, needs_input instead of guessed values |
Plans are reviewable records, not operating authorizations |
Verification
- 153 automated tests, including live replay of every catalogue product, phase and acid case against pinned PHREEQC 3.8.6 (USGS).
- Hosted checks on Python 3.11, 3.12 and 3.13, plus clean wheel and source installation checks.
- Evidence is versioned per release in the release evidence.
This is computational evidence. FlahaX has not been validated in the laboratory or in the field, and its owner's computational assessment is not an independent review. No recipe, pH or EC value is an authorization to operate equipment.
Roadmap
Next work, in order: broader numerical and input-boundary testing, stable consumer contracts, and a validated conductivity model covering irrigation-strength solutions first and concentrated stock tanks second. See the development roadmap and current status.
Documentation
| Document | For |
|---|---|
| User manual | Installation, seven tested examples, units, chemistry, pH and delivery planning; also ships inside the package |
| API reference | Every public function and result record, with signatures |
| Site planning and CLI | Water, acid, EC and injection inputs |
| Chemistry model | Equilibrium model, PHREEQC evidence and boundaries |
| Formulation method | The ppm equation, solver and worked pepper example |
| Documentation index | All user, scientific and contributor documents |
| Changelog | Changes by release |
The manual can be read offline from an installed package through
importlib.resources (flahax/data/USER_GUIDE.md).
Development
From a source checkout:
python -m pip install -e .
PYTHONPATH=src python -m unittest discover -s tests -t .
Live PHREEQC replay, distribution verification and branch conventions are in package verification and CONTRIBUTING.
Citation
Al Khashan, R. A. (2026). FlahaX (Version 0.3.1) [Computer software]. https://pypi.org/project/flahax/
@software{alkhashan2026flahax,
author = {Al Khashan, Rafat A.},
title = {FlahaX: plant-nutrient chemistry engine for fertilizer formulation and delivery planning},
year = {2026},
version = {0.3.1},
url = {https://pypi.org/project/flahax/},
license = {Flaha Free Use License}
}
GitHub's "Cite this repository" button reads
CITATION.cff.
License
FlahaX is free to install and use for any purpose, including commercial work and research, under the Flaha Free Use License. It is not open source: modification and redistribution are not permitted.
Metadata
Release files for flahax 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| flahax-0.3.1.tar.gz | 3.4 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flahax-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.5 MB
Release files / flahax-0.3.1.tar.gz
| Download URL | flahax-0.3.1.tar.gz |
|---|---|
| Size | 3.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
526c1e770fdb10a1e5006348594a5ccbf1595061d2f96428ab9983bd3eccbddd
|
|
BLAKE2b-256 checksum How to use checksums |
553271cc9a46a76f10e22ce57e1e552b9dccd500249f2413876afdf75537946b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.0
|
Release files / flahax-0.3.1-py3-none-any.whl
| Download URL | flahax-0.3.1-py3-none-any.whl |
|---|---|
| Size | 117.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
508fabae05fcf4790fda9aab4ebbbe897a36a2158228d61242c845112345ce7b
|
|
BLAKE2b-256 checksum How to use checksums |
31e1dc77ca03c8d01fa4541536bc5aea56f9671071e649bb9c612d637f1f32d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.0
|
Security for flahax 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.