Source-aware parsing for annotation processors #12
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Different depositors write the same property differently. ChEBI might format pKa as
"pKa = 4.76 at 25 °C"while DrugBank writes"4.76 (Predicted)". TheAnnotationEntrycarries aSourceNamefield, but the current parser ignores it and runs every string through the same generic patterns.Knowing the source means we can apply tighter regex patterns per depositor: more successful parses, fewer false positives.
Scope
Fetch several pages of dissociation constant data, group by
SourceName, and document each source's typical string format for the top 5–10 depositors.Then pick a design. Two options:
Per-source pattern lists. The processor holds a
dict[str, list[Pattern]]mapping source names to specialized patterns. Known sources get their patterns tried first; unknown sources fall through to the generic set.Per-source subclasses. Each major source gets a small subclass overriding
parse_value. A factory selects the right one by source name.Implement the chosen approach to calculate dissociation constants using at least two sources. Add
source_nameto the output DataFrame. Document the design decision in the PR description.Definition of done
The
source_namecolumn is present in the output. Two source-specific parsing paths implemented and tested. Generic fallback still works for unknown sources.