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

Develop #127

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

group = 'org.monarchinitiative.poet'
version = '1.0.6'
version = '1.0.7'
sourceCompatibility = '11'

configurations {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
import java.util.Objects;

@Entity
@Table(
uniqueConstraints=
@UniqueConstraint(columnNames={"publication_id", "disease_id"})
)
public class AnnotationSource {

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,11 @@ public String getExtensionId() {
public String getExtensionLabel() {
return extensionLabel;
}

public String getExportPhenotypeId() {
if (hpoId.equals("HP:0000118")){
return super.getAnnotationSource().getDisease().getExportDiseaseId();
}
return hpoId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ public void exportMAXOAnnotations(PrintWriter writer, CSVFormat format, boolean

annotationService.getLastUpdatedForAnnotation(annotation);
annotationService.getCreatedDateForAnnotation(annotation);
String hpoId = annotation.getHpoId();
csvPrinter.printRecord(annotation.getAnnotationSource().getDisease().getExportDiseaseId(),
annotation.getAnnotationSource().getDisease().getDiseaseName(), reference,
annotation.getMaxoId(), annotation.getMaxoName(), annotation.getHpoId(), annotation.getRelation(),
annotation.getMaxoId(), annotation.getMaxoName(), annotation.getExportPhenotypeId(), annotation.getRelation(),
annotation.getEvidence(), annotation.getExtensionId(), annotation.getExtensionLabel(),
annotation.getComment(), "", annotation.getOwner().getExportName(), annotation.getExportLastUpdatedDate(), annotation.getCreatedDate()
);
Expand Down
2 changes: 1 addition & 1 deletion src/main/poet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "poet",
"version": "1.0.6",
"version": "1.0.7",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
<h2 mat-dialog-title>Source Selection</h2>
<mat-dialog-content class="mat-typography">
<!-- Find disease or publication, then find all annotation sources for it. -->
<div class="existing-curation" *ngIf="!newPublication">
<div *ngIf="selectedDisease">
<button class="new-btn" mat-stroked-button (click)="selectPublication('new')">New Publication</button>
<mat-selection-list #publications (selectionChange)="selectPublication(publications.selectedOptions.selected[0].value)" multiple="false">
<mat-list-option class="selection-wrapper" value="new">
<mat-icon matListIcon>add_box</mat-icon>
<div class="selection-text">
<strong>Add New Publication for {{selectedDisease.diseaseName}}</strong>
</div>
</mat-list-option>
<mat-list-option class="selection-wrapper"
*ngFor="let publication of annotatedPublications$ | async"
[value]="publication">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@
margin: 0 auto;
text-align: center;
}

.new-btn {
margin-left: 1rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { UntypedFormControl, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { CurationService } from '../../../shared/services/curation/curation.service';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
import { debounceTime, distinctUntilChanged, filter, map } from 'rxjs/operators';
import { PubmedService } from '../../../shared/services/external/pubmed.service';
import { StateService } from '../../../shared/services/state/state.service';
import { Publication } from '../../../shared/models/models';
Expand Down Expand Up @@ -105,17 +105,28 @@ export class DialogSourceComponent implements OnInit {
firstAuthor: this.selectedPublication.sortfirstauthor
}
};
this.curationService.savePublication(source).subscribe(() => {
this.annotatedPublications$ = this.curationService.getDiseasePublications(this.selectedDisease.diseaseId);
this.newPublication = false;
this.selectedPublication = source.publication;
this.closeDialog();
}, error => {
const message = this.getErrorMessage(error);
this._snackBar.open(message, 'Close', {
duration: 5000,
});
});

this.annotatedPublications$.pipe(
map(items =>
items.filter(item => item.publicationId == source.publication.publicationId)
)).subscribe((existing) => {
if(existing && existing.length > 0){
this.newPublication = false;
this.selectPublication(existing[0]);
} else {
this.curationService.savePublication(source).subscribe(() => {
this.annotatedPublications$ = this.curationService.getDiseasePublications(this.selectedDisease.diseaseId);
this.newPublication = false;
this.selectedPublication = source.publication;
this.closeDialog();
}, error => {
const message = this.getErrorMessage(error);
this._snackBar.open(message, 'Close', {
duration: 5000,
});
});
}
})
}

getErrorMessage(error: any) {
Expand Down