Merge PACs stuff with flows for processes#352
Merged
Conversation
It's currently unused.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #352 +/- ##
==========================================
+ Coverage 95.67% 95.74% +0.07%
==========================================
Files 28 27 -1
Lines 3211 3129 -82
Branches 3211 3129 -82
==========================================
- Hits 3072 2996 -76
+ Misses 62 61 -1
+ Partials 77 72 -5 ☔ View full report in Codecov by Sentry. |
Collaborator
|
Cool, was about to start #248, so will build off this |
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.
Description
Every process has at least one commodity flow, at least one of which must be designated as a PAC (primary activity commodity). Currently this information is contained in two input files:
process_flows.csvandprocess_pacs.csv. The latter just contains pairs of process and commodity IDs indicating which of the commodity flows are PACs for each process. The code reflects this input file structure: theProcessstruct has separateflowsandpacsfields, which isn't particularly usable. It means if you want to find out whether a given commodity flow is a PAC you have to iterate overProcess.pacsto check if it's in there. Conversely, to get the process flows corresponding to PACs, you have to find the flows whose commodity IDs match those inProcess::pacs.While the code doesn't actually use these data structures for anything other than validation yet, when we do come to use them (we need them for the dispatch optimisation), this will be annoying. We can simplify things by just adding a boolean flag to each process flow indicating whether or not it's a PAC. We can then delete the
process_pacs.csvexample file and most of the associated validation code, which is what I've done. I've moved the remaining PAC validation steps tosrc/input/process/flow.rs.Unrelated change: I also tidied up some doc comments in
src/process.rs.Closes #337. Fixes #338.
Type of change
Key checklist
$ cargo test$ cargo docFurther checks