Skip to content
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

Entities Integrity URL #1348

Merged
merged 5 commits into from
Feb 19, 2025
Merged

Conversation

sadiqkhoja
Copy link
Contributor

@sadiqkhoja sadiqkhoja commented Dec 23, 2024

Closes #668

Dependent on #1349

What has been done to verify that this works as intended?

Written tests. I have deployed this to dev environment for Collect team to start using this endpoint.

Why is this the best possible solution? Were any other approaches considered?

Used the existing pattern.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

Since Form manifest is changed, it should work with older Collect clients.

Does this change require updates to the API documentation? If so, please update docs/api.yaml as part of this PR.

yes

Before submitting this PR, please make sure you have:

  • run make test and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code from external sources are properly credited in comments or that everything is internally sourced

@sadiqkhoja sadiqkhoja force-pushed the features/668-integrity-url branch 5 times, most recently from a1f8727 to b066ea7 Compare January 6, 2025 18:56
@sadiqkhoja sadiqkhoja force-pushed the features/668-integrity-url branch from b066ea7 to ee4b6f2 Compare February 7, 2025 21:12
@sadiqkhoja sadiqkhoja marked this pull request as ready for review February 7, 2025 21:16
@sadiqkhoja sadiqkhoja requested a review from ktuite February 7, 2025 21:16
Copy link
Member

@ktuite ktuite left a comment

Choose a reason for hiding this comment

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

Looked at the code and tried it out and it looks like a good place to merge and have Collect try out.

I have one comment about getting the dataset name from the attachment name, and in my quest to try to break it (I couldn't), I found some other pre-existing issues.

#1403
#1404

docs/api.yaml Outdated

[Offline Entities support](https://forum.getodk.org/t/openrosa-spec-proposal-support-offline-entities/48052):

* If an attachemnt is linked to a Dataset, then `type="entityList"` attribute is added to the `mediaFile` element.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* If an attachemnt is linked to a Dataset, then `type="entityList"` attribute is added to the `mediaFile` element.
* If an attachment is linked to a Dataset, then `type="entityList"` attribute is added to the `mediaFile` element.

isDataset: attachment.datasetId != null
isDataset: attachment.datasetId != null,
integrityUrl: attachment.datasetId ?
`${data.domain}${data.projectPath}/datasets/${encodeURIComponent(attachment.name.replace(/\.[^/.]+$/, ''))}/integrity`
Copy link
Member

Choose a reason for hiding this comment

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

This building of the dataset name from the attachment name makes me nervous. What if there's a weird name that we matched successfully elsewhere but this doesn't work? How does this work in the case where the dataset is manually linked to the attachment? Can we get the name from the database OR can we have a utility that transforms attachment names to dataset names in a reliable way?

It should be the exact same mechanism in the PATCH attachment resource where an attachment name (with .csv or .CSV) is transformed into a dataset name that is then matched in the database.

@sadiqkhoja sadiqkhoja merged commit 37a72a5 into getodk:master Feb 19, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants