Skip to content

Commit

Permalink
Merge pull request #127 from EBISPOT/develop
Browse files Browse the repository at this point in the history
Publication import and Submission linking
  • Loading branch information
ala-ebi authored Apr 2, 2024
2 parents 99c70dc + b5c91d7 commit 003ba69
Show file tree
Hide file tree
Showing 38 changed files with 771 additions and 86 deletions.
4 changes: 4 additions & 0 deletions src/app/core/models/curationStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface CurationStatus {
curationStatusId: string;
status: string;
}
8 changes: 8 additions & 0 deletions src/app/core/models/curator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface Curator {
curatorId: string;
firstName: string;
lastName: string;
email: string;
// this is added in the front-end
fullName: string;
}
5 changes: 5 additions & 0 deletions src/app/core/models/publication.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { Curator } from './curator';
import { CurationStatus } from './curationStatus';

export interface Publication {
publicationId: string;
pmid: string;
Expand All @@ -10,4 +13,6 @@ export interface Publication {
email: string;
};
status: string;
curationStatus: CurationStatus;
curator: Curator;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ApiResponse } from './apiResponse';
import { CurationStatus } from '../../curationStatus';

export interface CurationStatusListApiResponse extends ApiResponse {
_embedded: {
curationStatusDToes: CurationStatus[];
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ApiResponse } from './apiResponse';
import { Curator } from '../../curator';

export interface CuratorListApiResponse extends ApiResponse {
_embedded: {
curatorDToes: Curator[];
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { EfoTrait } from '../../efoTrait';
import { ApiResponse } from './apiResponse';

export interface EfoTraitsListApiResponse extends ApiResponse {

_embedded: {
efoTraits: EfoTrait[];
};
Expand Down
7 changes: 7 additions & 0 deletions src/app/core/models/rest/api-responses/epmcImportResult.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Publication } from '../../publication';

export interface EpmcImportResult {
publicationDto: Publication;
pmid: string;
status: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { Publication } from '../../publication';

export interface PublicationListApiResponse extends ApiResponse {
_embedded: {
solrPublicationDToes: Publication[]
publications: Publication[]
};
}
9 changes: 9 additions & 0 deletions src/app/core/models/submissionMatchingReport.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface SubmissionMatchingReport {
submissionID: string;
pubMedID: string;
author: string;
doi: string;
cosScore: string;
levDistance: string;
jwScore: string;
}
3 changes: 3 additions & 0 deletions src/app/core/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export class AuthService {
}

isCurator() {
if (environment.WHITELISTED_CURATORS.indexOf(this.getDecodedToken()?.email) > -1) {
return true;
}
return this.getDecodedToken()?.domains?.indexOf('self.GWAS_Curator') > -1;
}

Expand Down
45 changes: 44 additions & 1 deletion src/app/core/services/publication.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export class PublicationService {

constructor(private http: CurationHttpService) { }

getPublications(size: number, page: number, sort: string, order: string, pmid: string, title: string, curator: string): Observable<PublicationListApiResponse> {
getPublications(size: number, page: number, sort: string, order: string, pmid: string, title: string, curator: string,
curationStatus: string, submitter: string): Observable<PublicationListApiResponse> {
let params: HttpParams = new HttpParams();
params = params
.set('size', String(size))
Expand All @@ -28,6 +29,48 @@ export class PublicationService {
if (curator) {
params = params.set('curator', curator);
}
if (curationStatus) {
params = params.set('curationStatus', curationStatus);
}
if (submitter) {
params = params.set('submitter', submitter);
}
return this.http.get('/publications', params);
}

getCurators() {
let params: HttpParams = new HttpParams();
params = params
.set('size', String(50))
.set('page', String(0));
return this.http.get('/curators', params);
}

getCurationStatuses() {
let params: HttpParams = new HttpParams();
params = params
.set('size', String(50))
.set('page', String(0));
return this.http.get('/curation-status', params);
}

updatePublicationCurationDetails(pmid: string, publicationCurationPatchDto: any) {
return this.http.patch('/publications/' + pmid + '/curation', publicationCurationPatchDto);
}

importPublicationsFromEpmc(pmids: string[]) {
return this.http.post('/publications/' + pmids.join(','));
}

getSubmissionMatchingReport(pmid: string) {
let params: HttpParams = new HttpParams();
params = params
.set('size', String(50))
.set('page', String(1));
return this.http.get('/publications/' + pmid + '/linked-submissions', params);
}

linkSubmission(pmid: string, submissionId: string) {
return this.http.put('/publications/' + pmid + '/link-submission', new HttpParams().set('submissionId', submissionId));
}
}
5 changes: 4 additions & 1 deletion src/app/core/services/study.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class StudyService {

constructor(private http: CurationHttpService) {}

search(size: number, page: number, sort: string, order: string, efoTrait: string, reportedTrait: string, note: string,
search(size: number, page: number, sort: string, order: string, efoTrait: string, reportedTrait: string, note: string, gcst: string,
sumstatsFlag: string, pooledFlag: string, gxeFlag: string) {
let params: HttpParams = new HttpParams();
if (size) {
Expand All @@ -30,6 +30,9 @@ export class StudyService {
if (note) {
params = params.set('note', note);
}
if (gcst) {
params = params.set('accessionId', gcst);
}
if (sumstatsFlag !== 'any' && sumstatsFlag != null) {
params = params.set('sumstatsFlag', String(sumstatsFlag));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</li>
</ul>
</label>
<button mat-raised-button color="primary" style="font-size:12px; margin-right: -10px;" class="gwas-elevation" (click)="downloadEfoTraitsExport()">
<button mat-raised-button color="primary" (click)="downloadEfoTraitsExport()">
<mat-icon>share</mat-icon>
Export Data
</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.ellipsis-col {
overflow: hidden;
max-width: 200px;
text-overflow: ellipsis;
white-space: nowrap;
}

td, th {
padding: 7px !important;
text-align: left;;
}

.loading-shade {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: rgba(0, 0, 0, 0.15);
z-index: 1;
display: flex;
align-items: center;
justify-content: center;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<h2 mat-dialog-title>Potential matches for PMID {{pmid}}</h2>
<h4 *ngIf="author">{{author}}</h4>
<h4 *ngIf="title">{{title}}</h4>
<mat-dialog-content class="mat-typography">
<div class="relative">
<div *ngIf="loadingInProgress" class="loading-shade">
<mat-spinner></mat-spinner>
</div>
<mat-checkbox class="mt-2" (change)="filter($event)">Include submissions having PMID</mat-checkbox>
<table mat-table [dataSource]="dataSource" class="w-full" matSort>
<ng-container matColumnDef="pubMedID">
<th mat-header-cell *matHeaderCellDef>PMID</th>
<td mat-cell *matCellDef="let row">{{row.pubMedID || 'NA'}}</td>
</ng-container>
<ng-container matColumnDef="submissionId">
<th mat-header-cell *matHeaderCellDef>SubmissionId</th>
<td mat-cell *matCellDef="let row">{{row.submissionID}}</td>
</ng-container>
<ng-container matColumnDef="author">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Author</th>
<td mat-cell *matCellDef="let row">{{row.author}}</td>
</ng-container>
<ng-container matColumnDef="title">
<th mat-header-cell *matHeaderCellDef>Title</th>
<td mat-cell *matCellDef="let row" class="ellipsis-col">
<span matTooltip="{{row.title}}" matTooltipClass="mat-tooltip">{{row.title || 'NA'}}</span>
</td>
</ng-container>
<ng-container matColumnDef="doi">
<th mat-header-cell *matHeaderCellDef>DOI</th>
<td mat-cell *matCellDef="let row">
<a *ngIf="row.doi" mat-button [href]="row.doi" target="_blank">
Open DOI <mat-icon color="primary" style="font-size: 20px">open_in_new</mat-icon>
</a>
</td>
</ng-container>
<ng-container matColumnDef="cosineScore">
<th mat-header-cell *matHeaderCellDef>Cosine Score</th>
<td mat-cell *matCellDef="let row">{{row.cosScore}}</td>
</ng-container>
<ng-container matColumnDef="linkSubmission">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let row">
<button mat-raised-button color="primary" [disabled]="row.pubMedID != null" (click)="linkSubmission(row.submissionID, row.author)">
Link submission
</button>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
<tr class="mat-row" *matNoDataRow>
<td class="mat-cell text-center" colspan="9999">
<h3>No submissions found for PMID</h3>
</td>
</tr>
</table>
<mat-paginator [length]="resultsLength" [pageSizeOptions]="[5, 10, 20]" showFirstLastButtons></mat-paginator>
</div>
</mat-dialog-content>
<div mat-dialog-actions>
<button mat-button mat-dialog-close>Close</button>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { CheckSubmissionDialogComponent } from './check-submission-dialog.component';

describe('CheckSubmissionDialogComponent', () => {
let component: CheckSubmissionDialogComponent;
let fixture: ComponentFixture<CheckSubmissionDialogComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ CheckSubmissionDialogComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(CheckSubmissionDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading

0 comments on commit 003ba69

Please sign in to comment.