Skip to main content

FlahaX

PyPI Python License

FlahaX selects a fertilizer combination and the grams of each salt for a fixed crop formula. Version 0.2.0. The formula stays as written. This season’s water is subtracted from it, and the salts cover the gap that remains. Every real salt in the shipped library is a candidate. Non-negative grams decide which salts stay in the mix.

The package is separate from the FlahaFAST application. FlahaFAST does not import it.

Install

Python 3.11 or newer. There are no third-party dependencies.

py -m pip install flahax

A checkout of this repository can be installed for local work:

py -m pip install -e .

Quick start

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")

The same solve accepts one JSON object on standard input:

@'
{"targets": {"N_NO3": 128, "P": 58, "K": 211, "Ca": 104, "Mg": 40, "S": 54}, "water": {"Ca": 20}}
'@ | flahax

result["salts"] lists each chosen salt and its gramsPerLitre. result["rows"] lists each element with its target, the final concentration in ppm, and deltaPct. Grams are for one litre of the solution the plant sees.

Element symbols follow the formula database: N_NO3, N_NH4, P, K, Ca, Mg, S, Fe, Mn, Zn, B, Cu, Mo.

Worked example

Edited pepper targets, with 20 ppm calcium already in the water, stay inside 1% on every targeted element. The fit uses six salts:

Salt g/L
Potassium nitrate 0.546
Magnesium nitrate 0.415
Calcium sulfate 0.290
Phosphoric acid (75%) 0.146
Calcium nitrate (ag grade) 0.046
Calcium monobasic phosphate 0.048

The ppm equation, the Lawson–Hanson solve, the library counts, and the regression case are in docs/method.md.

Citation

Please cite FlahaX when the package, or a recommendation it produced, is used in a report or a paper.

Al Khashan, R. A. (2026). FlahaX (Version 0.2.0) [Computer software]. https://pypi.org/project/flahax/

@software{alkhashan2026flahax,
  author  = {Al Khashan, Rafat A.},
  title   = {FlahaX: fertilizer salt selection for a fixed crop formula},
  year    = {2026},
  version = {0.2.0},
  url     = {https://pypi.org/project/flahax/},
  license = {Flaha Free Use License}
}

GitHub reads CITATION.cff for the “Cite this repository” button. That file carries the same record.

Documentation

Document Contents
docs/usage.md Library call, command line, inputs, and result fields
docs/method.md ppm equation, solver, library file, and the pepper proof
INTEGRATION.md Calling FlahaX from FlahaFAST without changing the current flow
docs/publishing.md Building and releasing a new version

From a checkout, the tests are:

py -m unittest discover -s tests -t .

Scope of version 0.2.0

This version returns grams for one litre of working solution. A salt is dosed from the shipped library only when its assay uses known ions and its formula does not rule the assay out. Default recipes leave out carbonate salts, and they leave out sodium and chloride unless the formula asks for that ion or the caller allows it. The result reports whether every requested ion landed inside 1%, plus warnings.

It does not split tanks, adjust pH, price the mix, or apply a concentration factor. It does not write to the FlahaFAST database.

License

Use of FlahaX is free of charge, including commercial use, under the Flaha Free Use License. That license permits installation and running of an official copy. Modification, forking, republishing, and giving copies to anyone else require permission from the copyright holder. The license is a proprietary free-use license.

Release files for flahax 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flahax 0.2.0
File Size Uploaded
flahax-0.2.0.tar.gz 26.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flahax 0.2.0
File Interpreter ABI Platform
flahax-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.6 kB

Release files / flahax-0.2.0.tar.gz

Download URL flahax-0.2.0.tar.gz
Size 26.3 kB
Tags Source
SHA-256 checksum
How to use checksums
07ee49d41892bbd65dc820086589dc728cbe776b30bd68c234eecfa703491f8b
BLAKE2b-256 checksum
How to use checksums
7aad110c479b0f31fd7f7d7d07a97bae91b37a60b4dd908e8957752a37103690
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.2.0-py3-none-any.whl

Download URL flahax-0.2.0-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20a55b61f8b0e14383fbce0f01847635d903cd22c594a3cebbe29c8b7c210d83
BLAKE2b-256 checksum
How to use checksums
27e743b386d4573b2848a1e197622581fab1eeb9c3e36d6486a75a8aaaaca51e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page