Repository navigation
refactor: gather the nitrogen rules in nitrogen.py and break the remedies cycle - #326
Merged
Merged
Conversation
…OGEN_FORMS nitrogen_rows, fitted_targets, total_nitrogen and target_total_nitrogen move from composition, and the ammonium allowance and total_n_report from engine. materials and label_reconciliation use the shared form tuple.
…workflow and the remedies no longer import each other
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #326 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 147 148 +1
Lines 17459 17464 +5
Branches 3539 3539
=========================================
+ Hits 17459 17464 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #325.
nitrogen.pyholdsNITROGEN_FORMS,TOTAL_NITROGEN_TOLERANCE,nitrogen_rows,fitted_targets,total_nitrogenandtarget_total_nitrogen(fromcomposition), andammonium_allowance,ammonium_allowance_preset,total_n_reportand theAMMONIUM_*constants (fromengine).validate_targetsstays incomposition. No re-export shim; importers and tests re-point.materialsandlabel_reconciliationimport the sharedNITROGEN_FORMSinstead of their own copies.evaluate_remediestakes the planner as a required keywordplan;plan_fertilizer_workflowpasses itself. Both deferred imports of thefertilizer_workflow/evaluated_remediescycle go. New test: each scenario runs through the planner that is passed in.Left alone, for a separate decision:
joint_problemsums the three forms inline withsum, whiletotal_nitrogenusesmath.fsum. Using one function could change the last bit of a result.Verification: two snapshots from
mainwere compared after each commit and are identical (64-hex hashes masked): 48 files for 11 nitrogen target sets (plain, with the ammonium allowance, with an NH4-N maximum, the workflow, a contradicting total and a batch with a total-N targets file) and 31 files for the batch and mix scenarios. Every runnable test module passes;test_mix_cliandtest_grower_journeywere run test by test.test_file_headersfails the same 434 cases asmainon Windows. Not run locally: the slow ratio modules (they reach this code only throughrecommend, covered by the snapshot) and the pre-push script (over 5 minutes). No chemistry changed, so the PHREEQC fixture is not re-captured.