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

EVA-3475 - Release count endpoints v2 #177

Merged
merged 12 commits into from
Apr 9, 2024

Conversation

tcezard
Copy link
Member

@tcezard tcezard commented Mar 14, 2024

No description provided.

@tcezard tcezard marked this pull request as draft March 14, 2024 10:45
@tcezard tcezard marked this pull request as ready for review March 17, 2024 22:52
Copy link
Contributor

@apriltuesday apriltuesday left a comment

Choose a reason for hiding this comment

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

I guess there's some updates to be made to support the lists of taxonomies/assemblies, but here are my comments on the rest (mostly naming things)


import org.hibernate.annotations.Type;

import javax.persistence.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should avoid wildcard imports

Copy link
Contributor

Choose a reason for hiding this comment

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

In case IntelliJ puts a wildcard when you format using the shortcut, you can change the default value in
File -> Settings -> Editor -> Code -Style -> Java -> Imports tab

  • Class count to use import with '*': Set this value to something like 50 (default is 5)


public class ReleaseStatsPerSpeciesV2Dto extends ReleaseStatsPerV2Dto {

@Id
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@Id


public class ReleaseStatsPerAssemblyV2Dto extends ReleaseStatsPerV2Dto {

@Id
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@Id

@Id
private String assemblyAccession;

@Id
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@Id

package uk.ac.ebi.eva.release.dto;

import javax.persistence.Id;
import java.util.Objects;
Copy link
Contributor

Choose a reason for hiding this comment

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

unused imports

@Id
private String assemblyAccession;

private String rsType;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private String rsType;
@Id
private String rsType;

If you don't intend this to be part of ID, you should probably remove it from ReleaseStatsPerAssemblyViewPK as well

private Long count;

@Column(name="new")
protected Long newAddition;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
protected Long newAddition;
private Long newAddition;

private int taxonomyId;
@Id
private int releaseVersion;
private String rsType;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private String rsType;
@Id
private String rsType;

If you don't intend this to be part of ID, you should probably remove it from ReleaseStatsPerAssemblyView as well

private Long count;

@Column(name="new")
protected Long newAddition;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
protected Long newAddition;
private Long newAddition;

Comment on lines 77 to 80
if (!keyToDto.containsKey(key)) {
keyToDto.put(key, new ReleaseStatsPerSpeciesV2Dto());
}
ReleaseStatsPerSpeciesV2Dto dto = keyToDto.get(key);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!keyToDto.containsKey(key)) {
keyToDto.put(key, new ReleaseStatsPerSpeciesV2Dto());
}
ReleaseStatsPerSpeciesV2Dto dto = keyToDto.get(key);
ReleaseStatsPerSpeciesV2Dto dto = keyToDto.computeIfAbsent(key, k -> new ReleaseStatsPerSpeciesV2Dto());

Optional

tcezard and others added 5 commits March 24, 2024 11:04
Change PK to be embeded to enable join with taxonomy
Join with evapro.taxonomy to get scientific name and common name
Co-authored-by: April Shen <april.tuesday@gmail.com>
@tcezard
Copy link
Member Author

tcezard commented Mar 25, 2024

Please take a new look now that we're using the wide version of the aggregate table

import java.util.Objects;

@Entity
@IdClass(ReleaseStatsPerAssemblyV2PK.class)
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 be an @EmbeddedId as in the taxonomy model? (I'm not sure I understand the reason to use one form vs. another, just wondering if they should be the same.)

Copy link
Member Author

Choose a reason for hiding this comment

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

I mostly copied the old data model way but it was incompatible with joining with Taxonomy which is why I switch it to using @EmbeddedId.
You're right though that we should keep them consistent so I updated this class to use @EmbeddedId as well.

this.releaseInfoRepository = releaseInfoRepository;
}

public Map<Integer, String> getReleasesFtp() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is a util class, It will be better to have this as a method with a parameter (can also be static)

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I was trying to find a way to provide the FTP as a singleton so that we're not making the same query to the database too many time.
There might be a better way of doing that.

eva-release/pom.xml Show resolved Hide resolved
tcezard and others added 4 commits March 27, 2024 10:47
@tcezard tcezard merged commit f384731 into EBIvariation:master Apr 9, 2024
1 check passed
@tcezard tcezard self-assigned this Jun 28, 2024
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