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

added the sorted-name-length-pair attribute to the model #30

Merged
merged 5 commits into from
Aug 17, 2023

Conversation

waterflow80
Copy link
Collaborator

Added the sorted-name-length-pairs attribute to the model.
You can test the endpoints at PUT: SERVER_IP/eva/webservices/seqcol/collection/admin/seqcols/GCA_000146045.2, or at
GET: /eva/webservices/seqcol/collection/eJ8GCVLEVtdnCN4OSqfkf6KoEOK9OUlr?level=2 .

" \"name\": \""+ name +"\",\n" +
" \"length\": \""+ length +"\",\n" +
return "{" +
" \"name\": \""+ name +"\"," +
Copy link
Member

Choose a reason for hiding this comment

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

Do we still need the leading tabspace before the attributes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think it's referring to a tabspace, but rather to an escape character \ to keep the double quotes that surrounds each attribute's name, which is required by the specification as far as I know.

Copy link
Member

@sundarvenkata-EBI sundarvenkata-EBI Aug 17, 2023

Choose a reason for hiding this comment

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

I meant the whitespace between the double quotes and the first backslash...

Copy link
Collaborator Author

@waterflow80 waterflow80 Aug 17, 2023

Choose a reason for hiding this comment

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

Ohh okay, sorry.
I don't think we need that, although it's gonna be removed in the canonicalisation process. But it makes sense to remove it to reduce the effort for that function.

SHA512ChecksumCalculator sha512ChecksumCalculator = new SHA512ChecksumCalculator();
List<String> sortedNameLengthPairs = new ArrayList<>();
for (NameLengthPairEntity entity: nameLengthPairList) {
String nameLengthHash = sha512ChecksumCalculator.calculateChecksum(entity.toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this use the DigestCalculator so that the string is JSON canonicalized? Then you can keep the toString method human-readable. It also seems to be what the python implementation does.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Absolutely, that's a good point.
I recently figured that out and created a to-do issue #32 to fix it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah sorry, didn't see the issue - thanks!

@@ -0,0 +1,25 @@
package uk.ac.ebi.eva.evaseqcol.model;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why this is in model rather than entities?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just wanted to separate intermediate classes from the seqCol's and assembly's entities, which are mostly persistent.
However, it might not be the best approach.
It maybe better to put it in entities.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with the separation, just wanted to understand the reason - it's true that there's a lot of things in entities now!

@waterflow80 waterflow80 merged commit 6af09f5 into EBIvariation:main Aug 17, 2023
1 check passed
@waterflow80 waterflow80 deleted the sorted-name-length-pair branch October 20, 2023 21:25
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.

3 participants