Skip to content

[SDK] Migrate PA/CA example plugins to plugin contract + publish docs #746

Closed as not planned

Description

@SnowboardTechie

Summary

Migrate the PA and CA example opportunity transformers to use the new Plugin contract, and publish a getting-started guide for plugin authors on the CommonGrants website. This validates the contract end-to-end with real-world data shapes and gives adopters a reference implementation.

Acceptance criteria

  • examples/pa-opportunity-example/src/common_grants/utils/opp_transform.py refactored to construct a Plugin via define_plugin(schemas={'Opportunity': ObjectSchemasInput(...)}, extensions=PluginExtensions(...))
  • examples/ca-opportunity-example/src/common_grants/utils/opp_transform.py refactored similarly
  • A getting-started guide added under website/src/content/docs/ covering: constructing DefinePluginOptions, using definePlugin() / define_plugin(), the three transform construction paths (hand-written, buildTransforms() output, mapping auto-generation via extensions)
  • Both example plugins pass their existing test suites after migration

Related

Activity

  1. added a commit that references this issue on Apr 20, 2026
  2. changed the title [-][SDK] Migrate PA/CA example adapters to adapter contract + publish docs[/-] [+][SDK] Migrate PA/CA example plugins to plugin contract + publish docs[/+] on Apr 22, 2026
  3. jcrichlake commented on Apr 23, 2026

    @jcrichlake
    Collaborator

    You may want to double check this task as I don't think those PA and CA examples are returning real data so I don't think this would validate the contract end to end with real world data.

    If you wanted to do something like that you could potentially have something that calls one of the simpler-grants-gov (non common grants) api endpoints and then does a transform of that data to the common grants format and back.

  4. SnowboardTechie commented on Apr 23, 2026

    @SnowboardTechie
    CollaboratorAuthor

    Thanks for flagging this, good catch. Poked at the examples to double-check before moving forward.

    The PA and CA data is actually a real snapshot from live state grant APIs (PA from egrants-apibeta.azurewebsites.net, noted in source.txt; CA from data.ca.gov, snapshotted 2025-06-16 per its README). But you're pointing at a real gap regardless: the snapshots are stale, the example tests use made-up fixtures rather than the snapshot content, and nothing exercises the bidirectional to_common / from_common round-trip that the new Plugin contract unlocks.

    I'm leaning toward splitting this into two issues instead of rolling everything into #746:

    1. Keep [SDK] Migrate PA/CA example plugins to plugin contract + publish docs #746 scoped as-is: migrate PA/CA to the new Plugin contract and publish the getting-started docs. That gives existing adopters (anyone who forked PA/CA) a concrete migration reference.
    2. File a sibling issue for a reference plugin that calls a live simpler-grants-gov endpoint (POST /v1/opportunities/search), runs from_common(to_common(x)) on the response, and diffs. Live data plus round-trip, which is the stronger validation you're suggesting. Likely folds into [SDK] Reference plugins #561.

    Does that split land well, or would you rather I roll the round-trip work into #746 directly?

  5. jcrichlake commented on Apr 23, 2026

    @jcrichlake
    Collaborator

    I think that split makes sense, I would say for point 2 maybe we could just expand our existing plugins so we don't have the overhead of having to standup a new repo or trying to shove it into the current mono-repo

  6. SnowboardTechie commented on Apr 23, 2026

    @SnowboardTechie
    CollaboratorAuthor

    Makes sense, went with that. Filed #768 to track the from_common + round-trip work on the existing PA/CA examples, with a live-fetch refresh flagged as optional stretch so it doesn't chain to CI flakiness.

  7. jcrichlake commented on May 8, 2026

    @jcrichlake
    Collaborator

    Revisiting this as part of trying to build out some of our epics and I think we should maybe put this item in a "would be nice" bucket. I think the other Acceptance criteria will be met by expanding our 2 existing plugins in the common-grants repository.

  8. karinamzalez commented on Sep 22, 2026

    @karinamzalez
    Collaborator

    Closing as not planned during the #1102 triage. Three of the four acceptance criteria target examples/pa-opportunity-example and examples/ca-opportunity-example, which ADR 0029 deletes from the monorepo in #1180. The plugin contract has since been validated by the published plugins in the common-grants org (ts-cg-grants-gov, py-cg-grants-gov, cg-omb) and #561 closed as complete, which matches @jcrichlake's read that the remaining value is covered by the existing plugins.

    One piece does not have a home: a plugin-author getting-started guide on the website. Today only ADR 0022 and the SDK extension READMEs cover definePlugin / define_plugin. If we want that guide, it should be filed as a [Website] ticket that does not depend on the legacy examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew capability. Belongs on a hold branch.sdkIssue or PR related to our SDKs

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions