Commit 8cc100aa authored by Quentin David's avatar Quentin David
Browse files

Update to Models

parent 7a4a3fc6
...@@ -15,6 +15,7 @@ pnpm-debug.log* ...@@ -15,6 +15,7 @@ pnpm-debug.log*
# Editor directories and files # Editor directories and files
.idea .idea
.vscode .vscode
*.code-workspace
*.suo *.suo
*.ntvs* *.ntvs*
*.njsproj *.njsproj
......
...@@ -12,36 +12,68 @@ const Schema = mongoose.Schema; ...@@ -12,36 +12,68 @@ const Schema = mongoose.Schema;
// Can be a text file or something else like a model. // Can be a text file or something else like a model.
/* Should there be documentId or corpusId? */ /* Should there be documentId or corpusId? */
const OutputSchema = new Schema({ const OutputSchema = new Schema({
processId: { type: String, required: true}, processId: { type: String, required: true},
content: { type: String, required: true} moduleName: { type: String, required: true}, // Can be built from processId
content: {
title: { type: String },
description: { type: String },
data: { type: String, required: true}
}
}); });
// An annotation is the conjunction of a module and a document. // An annotation is the conjunction of a module and a document.
// It must contains all the informations needed for the visualisation tool to work. // It must contains all the informations needed for the visualisation tool to work.
const AnnotationSchema = new Schema({ const AnnotationSchema = new Schema({
documentId: { type: String, required: true}, documentId: { type: String, required: true}, // Needed ?
processId: { type: String, required: true}, processId: { type: String, required: true},
content: { type: String }, moduleName: { type: String, required: true}, // Can be built from processId
colour: { type: String } content: {
title: { type: String },
description: { type: String },
data: { type: String, required: true}
},
color: { type: String }
}) })
// Documents are build at the end of the pipeline // Documents are build at the end of the pipeline
// It contains the source text and // It contains the source text and
// the annotations added by a pipeline // the annotations added by a pipeline
const DocumentSchema = new Schema({ const DocumentSchema = new Schema({
corpusId: { type: String, required: true}, corpusId: { type: String, required: true}, // Needed ?
source: { type: String }, source: { type: String },
annotations: { type: [AnnotationSchema] } annotations: { type: [AnnotationSchema] }
})
// The content of a column with ConLLU-Plus style, each row corresponding to a token.
const ConLLuColumnSchema = new Schema({
columnId: {type: String }, // Needed ?
columnTitle: { type: String, required: true},
columnData: { type: String, required: true}
})
const MetadataSchema = new Schema({
author: {type: String },
title: {type: String },
description: {type: String },
date: {type: String },
type: {type: String },
size: {type: String },
userMetadata: [{
name: {type: String },
value: {type: String }
}]
}) })
// A corpus is composed of those attributes // A corpus is composed of those attributes
const CorpusSchema = new Schema({ const CorpusSchema = new Schema({
corpus_name: { type: String}, corpusId: { type: String},
conllu: { type: String}, // ConLLu annotation file pipelineId: { type: String }, // What happens if there is two pipeline
outputs: { type: [OutputSchema]}, conlluColumns: { type: [ConLLuColumnSchema]},
documents: [{content: String}], outputs: { type: [OutputSchema]},
created_by: { type: String}, documents: { type: [DocumentSchema]},
metadata: [{name: String, value: String}] createdBy: { type: String}, // userId or public
creationDate : { type: String },
metadata: { type: MetadataSchema }
}); });
// Let's compile as a model // Let's compile as a model
const CorpusModel = mongoose.model('CorpusModel', CorpusSchema); const CorpusModel = mongoose.model('CorpusModel', CorpusSchema);
......
...@@ -9,18 +9,27 @@ const Schema = mongoose.Schema; ...@@ -9,18 +9,27 @@ const Schema = mongoose.Schema;
// A process contains the information needed for a module to be executed // A process contains the information needed for a module to be executed
/* Should it contains corpusId? */ /* Should it contains corpusId? */
const ProcessSchema = new Schema({ const ProcessSchema = new Schema({
moduleName: { type: String, required: true}, moduleName: { type: String, required: true},
moduleParameter: { type: [{name: String, value: String}] } moduleParameter: {
type:
[{
name: String,
value: String
}],
required: true
}
}) })
// A pipeline contains the instruction to apply one or several // A pipeline contains the instruction to apply one or several
// modules to a corpus. // modules to a corpus.
const PipelineSchema = new Schema({ const PipelineSchema = new Schema({
corpusId: String, corpusId: { type: String, required: true },
currentProcessingModule: String, // What module is currently processing the corpus? currentProcessingModule: { type: String }, // What module is currently processing the corpus?
status: { status: {
type: String, type: String,
enum: ['Not started yet', 'Started', 'Finished', 'Failed'] enum: ['Not started yet', 'Started', 'Finished', 'Failed']
}, },
processes: { type: [ProcessSchema] } processes: { type: [ProcessSchema] , required: true},
creationDate: { type: String },
description: { type: String }
}) })
\ No newline at end of file
...@@ -10,13 +10,16 @@ const Schema = mongoose.Schema; ...@@ -10,13 +10,16 @@ const Schema = mongoose.Schema;
const UserSchema = new Schema({ const UserSchema = new Schema({
name: { type: String}, name: { type: String},
mail: { type: String}, mail: { type: String},
password: { type: String },
status: { status: {
type: String, type: String,
enum: ['User','Admin'] enum: ['User','Admin']
}, },
password: { type: String },
profileCorpora: {type: [{ corpusId: String }]}, profileCorpora: {type: [{ corpusId: String }]},
pipelines: { type: [{pipelineId: String, status: String}]}, pipelines: { type: [{pipelineId: String, status: String}]},
config: {
sendMailWhenPipelineFinished: { type: Boolean, default: true}
}
}); });
// Let's compile as a model // Let's compile as a model
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment