refactor: Declarative calcdocs API — flat node lists replace helper pyramids#1228
Closed
nathan-stender wants to merge 1 commit into
Closed
refactor: Declarative calcdocs API — flat node lists replace helper pyramids#1228nathan-stender wants to merge 1 commit into
nathan-stender wants to merge 1 commit into
Conversation
…node lists Introduce a flat, config-based API (CalcDoc, Measurement, build_calc_docs) for defining calculated data dependency graphs. This replaces 50+ nested helper functions across parsers with readable node list constants, making it clear how to add/edit calc docs without understanding the internal resolution engine. - New: calcdocs/builder.py (Measurement, CalcDoc, build_calc_docs) - New: calcdocs/views.py (shared FieldView, UuidView, SampleView, TargetView, etc.) - Migrated: appbio_quantstudio, designandanalysis, unchained_labs, msd_workbench, cytiva_biacore, bmg_labtech parsers - Removed: 7 redundant parser-specific view/config files - Moved CalculatedDataConfigWithOptional to core config.py - Net reduction: ~400 lines Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
CalcDoc,Measurement,build_calc_docs) for defining calculated data dependency graphsFieldView,UuidView,SampleView,TargetView,TargetRoleView) eliminating duplicate implementationsMotivation
The old API required writing a helper function per calculated document, resulting in deeply nested pyramids (8 levels in
relative_standard_curve) that were hard to read, maintain, or extend. The new declarative lists make the dependency graph visible at a glance — adding a new calc doc is one line, not a new function.What changed
calcdocs/builder.pyMeasurement,CalcDoc,Node,build_calc_docs()calcdocs/views.pyFieldView,UuidView,ViewWithReference,SampleView,TargetView,TargetRoleViewcalcdocs/config.pyCalculatedDataConfigWithOptional, removed dead codecalcdocs/__init__.pyappbio_quantstudioappbio_quantstudio_designandanalysisunchained_labs_lunatic_stunnermsd_workbenchcytiva_biacore_t200_controlbmg_labtech_smart_controlbuild_calc_docsTest plan
hatch run test_all.py3.10:pytest tests/parsers/ -x -q)🤖 Generated with Claude Code