Skip to content

Feat/Add Attestations API Endpoint #422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

landonshumway-ia
Copy link
Collaborator

@landonshumway-ia landonshumway-ia commented Jan 2, 2025

We are required to track the historical version of attestations to show what attestation text a user agreed to when they performed an action in the system. This adds the schema design for attestation version records, which we will be storing in the Compact Configuration Table. This adds a new endpoint GET /v1/compacts/{compact}/attestations/{attestationId} that retrieves the latest version of an attestation text by its ID.

We need the system to likely support multiple languages, which means attestations need to specify a locale, as legal language is very specific and likely cannot be auto-translated. This adds the locale to the SK and record data to keep locales decoupled from one another.

The Attestation records will be stored according to the following pk and sk pattern:

pk: COMPACT#{compact}#ATTESTATIONS
sk: COMPACT#{compact}#LOCALE#{locale}#ATTESTATION#{attestation_type}#VERSION#{version}

and will contain the following fields given in the example below:

{
  "type": "attestation",
  "attestationId": "jurisprudence-confirmation",
  "displayName": "Jurisprudence Confirmation",
  "description": "For displaying the jurisprudence confirmation",
  "compact": "aslp",
  "version": "1",
  "dateCreated": "2024-06-06T23:59:59+00:00",
  "dateOfUpdate": "2024-06-06T23:59:59+00:00",
  "text": "You attest that you have read and understand the jurisprudence requirements for all states you are purchasing privileges for.",
  "required": true,
  "locale": "en"
}

Requirements List

  • None, this is a backwards compatible change

Description List

  • Added AttestationRecordSchema for serializing/deserializing attestation records with version tracking
  • Added CompactConfigurationClient with a method to fetch the latest version of an attestation using DynamoDB's sort key functionality
  • Added attestation lambda directory
  • Added GET endpoint for getting the latest version of an attestation record.

Testing List

  • Smoke test updated to verify feature against sandbox environment
  • For API configuration changes: CDK tests added/updated in backend/compact-connect/tests/unit/test_api.py
  • Code review

Closes #304

@landonshumway-ia landonshumway-ia force-pushed the feat/attestation-tracking branch from 1d87621 to c6938a7 Compare January 6, 2025 15:37
@landonshumway-ia landonshumway-ia marked this pull request as ready for review January 7, 2025 20:48
Copy link
Collaborator

@jusdino jusdino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! A couple of questions mostly:

- setting max length for new attestation fields
- enable alarm, but disable alarm action
Copy link
Collaborator

@jusdino jusdino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Ready for you, @jlkravitz .

@jlkravitz jlkravitz self-requested a review January 13, 2025 16:23
Copy link
Collaborator

@jlkravitz jlkravitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! couple nits

Copy link
Collaborator

@jlkravitz jlkravitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isabeleliassen Good to merge.

@isabeleliassen isabeleliassen self-requested a review January 13, 2025 21:46
Copy link
Collaborator

@jlkravitz jlkravitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isabeleliassen Good to merge. Sorry about that!

@isabeleliassen isabeleliassen merged commit b6edd27 into csg-org:development Jan 13, 2025
2 checks passed
@landonshumway-ia landonshumway-ia deleted the feat/attestation-tracking branch January 28, 2025 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

attestations saved (backend)
4 participants