Migrate `DataPack` parsing to backend
- Dominant language
- TypeScript
- Stars
- 52
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
`Stave` is maintaining a manual `DataPack` parsing [function](https://github.com/asyml/stave/blob/9c600bf1700fd801f2deb8fcbfed217354a47eef/src/nlpviewer/lib/transform.ts#L11) in its frontend codebase, which is susceptible to any updates on the serialization schema in `Forte`. We already have the `DataPack` serialization/deserialization implemented in `Forte`, and it might be hard to maintain two `DataPack` parsing systems at the same time. A more reasonable solution is to migrate the parsing logics to backend and let `Forte` handle most of the encoding/decoding work of `DataPack`.
**Describe the solution you'd like**
* Utilize `DataPack.from_string()` and `DataPack.to_string()` for parsing and encoding.
* Certain backend API should be updated.
* Frontend logics should also be changed correspondingly.
**Describe alternatives you've considered**
We might also need to refactor some of the handlers in [stave_viewer.py](https://github.com/asyml/stave/blob/master/simple-backend/stave_backend/lib/stave_viewer.py) to ensure that [StaveProcessor](https://github.com/asyml/forte/blob/ac34f102ebb3319c1e23f2f81e20a7e9e6c5e60d/forte/processors/stave/stave_processor.py#L52) won't break.
**Additional context**
* It might be blocked by https://github.com/asyml/forte/pull/692
* This updates should be thoroughly tested.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the manual DataPack parsing in src/nlpviewer/lib/transform.ts and the handlers in simple-backend/stave_backend/lib/stave_viewer.py. Check the DataPack.from_string() and DataPack.to_string() APIs in Forte, and review the related Forte pull request before changing the backend API and corresponding frontend logic. Done means both sides use the backend serialization path and the updated behavior is thoroughly tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, typescript
- Domain
- api, full-stack
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100