Add AnalysisCardBase support to json storage methods#5021
Open
mpolson64 wants to merge 1 commit intofacebook:mainfrom
Open
Add AnalysisCardBase support to json storage methods#5021mpolson64 wants to merge 1 commit intofacebook:mainfrom
mpolson64 wants to merge 1 commit intofacebook:mainfrom
Conversation
Summary: The json storage methods (`object_to_json` / `object_from_json`) currently has no support for serializing `AnalysisCardBase` and its subclasses -- serialization of analysis cards only exists in the SQA store. This diff adds JSON store support for the full `AnalysisCardBase` hierarchy: `AnalysisCard`, `AnalysisCardGroup`, `ErrorAnalysisCard`, `PlotlyAnalysisCard`, `MarkdownAnalysisCard`, `HealthcheckAnalysisCard`, and `GraphvizAnalysisCard`. **Approach:** A single encoder function handles all `AnalysisCard` leaf subclasses since they share the same fields (`name`, `title`, `subtitle`, `df`, `blob`, `timestamp`), with a `__type` discriminator carrying the concrete class name. A separate encoder handles `AnalysisCardGroup` which has `children` instead of `df`/`blob`. On the decoder side, the existing `ax_class_from_json_dict` generic dispatcher works since all constructors accept the serialized fields as kwargs. Differential Revision: D96490723
|
@mpolson64 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D96490723. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5021 +/- ##
=======================================
Coverage 96.84% 96.84%
=======================================
Files 604 604
Lines 65022 65037 +15
=======================================
+ Hits 62971 62987 +16
+ Misses 2051 2050 -1 ☔ View full report in Codecov by Sentry. 🚀 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.
Summary:
The json storage methods (
object_to_json/object_from_json) currently has no support for serializingAnalysisCardBaseand its subclasses -- serializationof analysis cards only exists in the SQA store. This diff adds JSON store
support for the full
AnalysisCardBasehierarchy:AnalysisCard,AnalysisCardGroup,ErrorAnalysisCard,PlotlyAnalysisCard,MarkdownAnalysisCard,HealthcheckAnalysisCard, andGraphvizAnalysisCard.Approach: A single encoder function handles all
AnalysisCardleafsubclasses since they share the same fields (
name,title,subtitle,df,blob,timestamp), with a__typediscriminator carrying theconcrete class name. A separate encoder handles
AnalysisCardGroupwhichhas
childreninstead ofdf/blob. On the decoder side, the existingax_class_from_json_dictgeneric dispatcher works since all constructorsaccept the serialized fields as kwargs.
Differential Revision: D96490723