Skip to content

Commit

Permalink
Merge pull request #187 from CogStack/more-metics-improvements
Browse files Browse the repository at this point in the history
CU-8693xmvd9: last_modified in the project model
  • Loading branch information
tomolopolis authored Apr 27, 2024
2 parents 081c8ee + 5b71cb3 commit ed3b9f4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
17 changes: 17 additions & 0 deletions webapp/api/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class Project(PolymorphicModel):
"outlininng a guide for annotators to follow for this project,"
"an example is available here: https://docs.google.com/document/d/1xxelBOYbyVzJ7vLlztP2q1Kw9F5Vr1pRwblgrXPS7QM/edit?usp=sharing")
create_time = models.DateTimeField(auto_now_add=True)
last_modified = models.DateTimeField(auto_now=True)
members = models.ManyToManyField(settings.AUTH_USER_MODEL)
dataset = models.ForeignKey('Dataset', on_delete=models.CASCADE)
validated_documents = models.ManyToManyField(Document, default=None, blank=True)
Expand Down Expand Up @@ -155,6 +156,11 @@ class EntityRelation(models.Model):
class Meta:
ordering = ['id']

def save(self, *args, **kwargs):
super().save(*args, **kwargs)
self.project.last_modified = self.last_modified
self.project.save()

def __str__(self):
return f'{self.start_entity} - {self.relation} - {self.end_entity}'

Expand Down Expand Up @@ -182,6 +188,11 @@ class AnnotatedEntity(models.Model):
class Meta:
ordering = ['id']

def save(self, *args, **kwargs):
super().save(*args, **kwargs)
self.project.last_modified = self.last_modified
self.project.save()

def __str__(self):
return str(self.entity)

Expand Down Expand Up @@ -243,6 +254,12 @@ class MetaAnnotation(models.Model):
meta_task_value = models.ForeignKey('MetaTaskValue', on_delete=models.CASCADE)
acc = models.FloatField(default=1)
validated = models.BooleanField(default=False)
last_modified = models.DateTimeField(auto_now=True)

def save(self, *args, **kwargs):
super().save(*args, **kwargs)
self.annotated_entity.last_modified = self.last_modified
self.annotated_entity.save()

def __str__(self):
return str(self.annotated_entity)
Expand Down
6 changes: 5 additions & 1 deletion webapp/frontend/src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
<template #cell(create_time)="data">
{{new Date(data.item.create_time).toLocaleDateString()}}
</template>
<template #cell(last_modified)="data">
{{new Date(data.item.last_modified).toLocaleString()}}
</template>
<template #cell(cuis)="data">
<div class="term-list">{{data.item.cuis.slice(0, 40) || 'All'}}</div>
</template>
Expand Down Expand Up @@ -190,11 +193,12 @@ export default {
{ key: 'name', label: 'Title', sortable: true },
{ key: 'description', label: 'Description' },
{ key: 'create_time', label: 'Create Time', sortable: true },
{ key: 'last_modified', label: 'Last Modified', sortable: true },
{ key: 'cuis', label: 'Concepts' },
{ key: 'require_entity_validation', label: 'Annotate / Validate' },
{ key: 'status', label: 'Status', sortable: true },
{ key: 'progress', label: 'Progress', formatter: this.progressFormatter },
{ key: 'anno_class', label: 'Annotation Classification'},
{ key: 'anno_class', label: 'Annotation Classification', sortable: true },
{ key: 'cdb_search_filter', label: 'Concepts Imported' },
{ key: 'model_loaded', label: 'Model Loaded' },
{ key: 'metrics', label: 'Metrics' },
Expand Down

0 comments on commit ed3b9f4

Please sign in to comment.