-
Notifications
You must be signed in to change notification settings - Fork 75
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
Tracking progress of Datasets & Entities #649
Comments
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Main issue: #666 It looks like it's currently not possible to purge forms if a soft-deleted form has a submission that has created an entity. I tried to write a test along those lines here: it('should allow a form that has created an entity to be purged', testService((service, container) =>
service.login('alice', (asAlice) =>
asAlice.post('/v1/projects/1/forms?publish=true')
.set('Content-Type', 'application/xml')
.send(testData.forms.simpleEntity)
.expect(200)
.then(() => asAlice.post('/v1/projects/1/forms/simpleEntity/submissions')
.send(testData.instances.simpleEntity.one)
.set('Content-Type', 'application/xml')
.expect(200))
.then(() => asAlice.patch('/v1/projects/1/forms/simpleEntity/submissions/one')
.send({ reviewState: 'approved' })
.expect(200))
.then(() => exhaust(container))
.then(() => asAlice.delete('/v1/projects/1/forms/simpleEntity')
.expect(200))
.then(() => container.Forms.purge(true))))); Right now the test fails with: error: update or delete on table "submission_defs" violates foreign key constraint "entity_defs_submissiondefid_foreign" on table "entity_defs" Once an entity is made from a submission, it lives its own lifecycle and deleting that submission (or parent form) won't alter the entity. Though at some point we need to handle entity deletion. For now:
|
Main issue: #666 Here's another one related to form purging, more of an edge case. If all the forms related to a dataset are purged, then the dataset is no longer listed, even though it might still be used in active forms as a form attachment. When we list datasets, we filter out datasets from form drafts that haven't been published yet. But I think the result of that filtering is also this behavior around purging. Here's the relevant SQL: central-backend/lib/model/query/datasets.js Lines 55 to 60 in 230dbb5
Here's a try at a test along these lines: it('should list a dataset even if related forms have been purged', testService((service, container) =>
service.login('alice', (asAlice) =>
asAlice.post('/v1/projects/1/forms?publish=true')
.set('Content-Type', 'application/xml')
.send(testData.forms.simpleEntity)
.expect(200)
.then(() => asAlice.get('/v1/projects/1/datasets')
.expect(200)
.then(({ body }) => {
body.length.should.equal(1);
}))
.then(() => asAlice.delete('/v1/projects/1/forms/simpleEntity')
.expect(200))
.then(() => container.Forms.purge(true))
.then(() => asAlice.get('/v1/projects/1/datasets')
.expect(200)
.then(({ body }) => {
body.length.should.equal(1);
}))))); To fix this, I think we may need to add a "published" flag to the Related case:
|
Main issue: #671 I've been taking a look at #576 and noticed these two remaining related TODOs from #633: central-backend/lib/resources/datasets.js Line 27 in 230dbb5
central-backend/test/integration/api/datasets.js Lines 85 to 93 in 230dbb5
|
Main issue: #676 If the form specifies a dataset name with leading or trailing white space, then it('should trim the dataset name', testService((service) =>
service.login('alice', (asAlice) =>
asAlice.post('/v1/projects/1/forms?publish=true')
.set('Content-Type', 'application/xml')
.send(testData.forms.simpleEntity.replace('people', ' people\n'))
.expect(200)
.then(() => asAlice.get('/v1/projects/1/datasets')
.expect(200)
.then(({ body }) => {
body.length.should.equal(1);
body[0].name.should.equal('people');
}))))); |
Main issue: #676 Another one about dataset name. I'm thinking that we shouldn't make that case-insensitive. xmlFormId and form attachment name are case-sensitive, so I think it makes sense for dataset name to be so as well. Dataset names can contain any Unicode letter, but I think it's difficult to combine that with case-insensitivity. For example, |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Main issue: #671 I'm noticing the following:
|
Main issue: #671 There seems to be some inconsistency around how we handle "draft Datasets" and form attachments:
|
This comment was marked as resolved.
This comment was marked as resolved.
Main issue: #671 Another one about form drafts + datasets. I'm seeing that as soon as you upload a form definition that would add a property to an existing dataset, that property is included in the entities CSV file. Even if you abandon the form draft, the property is still included in the CSV file. I'd expect that a property is added to the CSV file only once the draft is published. Add a |
Main issue: #676 One more thing to add under " Update dataset/entity parsing to reflect latest version of spec": we need to reject form definitions that are written for future spec versions. More here. We're going to release the first spec as 2022.1.0. The patch version is there to keep track of changes that don't affect compatibility (e.g. wording changes to the spec document, optional additions). So anything that doesn't start with 2022.1 should be rejected. Ideally the |
This comment was marked as resolved.
This comment was marked as resolved.
Closing this issue because everything mentioned in here is either completed 🎉 or captured in a new issue. |
🎉 🎉 👏 👏 👏 🎉 🎉 |
This issue tracks progress of the initial implementation of Datasets and Entities, including PRs, to-dos, and issues/bugs that we discover along the way. It is patterned off of a frontend issue about a large code migration.
entities
branchPR #576 represents the
entities
branch, a large initial chunk of work that covers:Things to get into this PR before merging
exists
vsblobExists
attachment API (comments)Critical to do before release:
Likely before release:
getByName
andgetByProjectAndName
(here)Collecting issues / unexpected behavior / bugs:
To come back to after release:
The text was updated successfully, but these errors were encountered: