Skip to content

Commit

Permalink
Merge pull request #131 from TheJacksonLaboratory/develop
Browse files Browse the repository at this point in the history
release 1.0.8
  • Loading branch information
iimpulse authored Jun 23, 2023
2 parents b6c97f4 + d3e6283 commit 925d052
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 24 deletions.
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.8'
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
4 changes: 2 additions & 2 deletions src/main/poet/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.8",
"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

0 comments on commit 925d052

Please sign in to comment.