Skip to content

Commit

Permalink
#19: Updated Address Schema and #18: Updated field inconsistencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
naodya committed Apr 12, 2020
1 parent 22616d1 commit de2ebe8
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 115 deletions.
16 changes: 16 additions & 0 deletions models/Address.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const AddressSchema = new Schema({
country: { type: String, required: true, max: 100 },
region: { type: String, max: 100 },
city: { type: String, max: 100 },
postalCode: { type: String, max: 100 },
street: { type: String, max: 100 },
building: { type: String, max: 100 },
customField1: { type: String, max: 100 },
customField2: { type: String, max: 100 },
});

// Export the model
module.exports = mongoose.model('Address', AddressSchema);
19 changes: 7 additions & 12 deletions models/Community.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const AddressModel = require('./Address');
const SymptomModel = require('./Symptom');

const CommunitySchema = new Schema(
{
firstName: { type: String, required: true, max: 100 },
Expand All @@ -9,26 +12,18 @@ const CommunitySchema = new Schema(
age: { type: Number, required: true },
sex: { type: String, required: true },
language: { type: String },
region: { type: String },
subcityOrZone: { type: String },
sefer: { type: String },
woreda: { type: String },
kebele: { type: String },
houseNumber: { type: String },
address: { type: AddressModel.schema },
symptom: { type: SymptomModel.schema },
phoneNumber: { type: String },
latitude: { type: Number },
longitude: { type: Number },
fever: { type: Boolean },
cough: { type: Boolean },
shortnessOfBreath: { type: Boolean },
formStatus: { type: String },
travelHx: { type: Boolean },
haveSex: { type: Boolean },
animalMarket: { type: Boolean },
contactWithSuspected: { type: Boolean },
contactWithConfirmed: { type: Boolean },
healthFacility: { type: Boolean },
occupation: { type: String },
dataSource: { type: String },
fatigue: { type: Boolean },
underlyingConditions: {
chronicLungDisease: { type: Boolean },
heartDisease: { type: Boolean },
Expand Down
33 changes: 14 additions & 19 deletions models/MedicalFacility.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,35 @@
const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const AddressModel = require('./Address');
const SymptomModel = require('./Symptom');

const MedicalFacilitySchema = new Schema(
{
firstName: { type: String, required: true, max: 100 },
middleName: { type: String, max: 100 },
lastName: { type: String, required: true, max: 100 },
nationality: { type: String },
email: { type: String },
sex: { type: String },
age: { type: Number },
region: { type: String },
subcity: { type: String },
zone: { type: String },
woreda: { type: String },
kebele: { type: String },
houseNumber: { type: String },
email: {
type: String,
lowercase: true,
match: [/\S+@\S+\.\S+/, 'is invalid'],
},
age: { type: Number, required: true },
sex: { type: String, required: true },
address: { type: AddressModel.schema },
symptom: { type: SymptomModel.schema },
phoneNumber: { type: String },
occupation: { type: String },
callDate: { type: Date },
callerType: { type: String },
fever: { type: Boolean },
cough: { type: Boolean },
headache: { type: Boolean },
runnyNose: { type: Boolean },
feelingUnwell: { type: Boolean },
shortnessOfBreath: { type: Boolean },
bodyPain: { type: Boolean },
travelHx: { type: Boolean },
haveSex: { type: Boolean },
animalMarket: { type: Boolean },
contactWithSuspected: { type: Boolean },
contactWithConfirmed: { type: Boolean },
healthFacility: { type: Boolean },
receiverName: { type: String },
source: { type: String },
formStatus: { type: String },
fatigue: { type: Boolean },
underlyingConditions: {
chronicLungDisease: { type: Boolean },
heartDisease: { type: Boolean },
Expand Down
33 changes: 18 additions & 15 deletions models/Passenger.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const AddressModel = require('./Address');
const SymptomModel = require('./Symptom');

const PassengerSchema = new Schema(
{
firstName: { type: String, required: true, max: 100 },
middleName: { type: String, max: 100 },
lastName: { type: String, required: true, max: 100 },
gender: { type: String },
age: { type: Number, required: true },
sex: { type: String, required: true },
dateOfBirth: { type: Date },
nationality: { type: String },
passportNo: { type: String },
Expand All @@ -16,27 +20,30 @@ const PassengerSchema = new Schema(
flightNumber: { type: String },
seatNumber: { type: String },
transitFrom: { type: String },
fever: { type: Boolean },
shortnessOfBreath: { type: Boolean },
cough: { type: Boolean },
address: { type: AddressModel.schema },
symptom: { type: SymptomModel.schema },
contactWithSuspected: { type: Boolean },
contactWithConfirmed: { type: Boolean },
dependents: [
{
firstName: { type: String, max: 100 },
firstName: { type: String, required: true, max: 100 },
middleName: { type: String, max: 100 },
lastName: { type: String, max: 100 },
gender: { type: String },
lastName: { type: String, required: true, max: 100 },
age: { type: Number, required: true },
sex: { type: String, required: true },
dateOfBirth: { type: Date },
nationality: { type: String },
passportNo: { type: String },
seatNumber: { type: String },
fever: { type: Boolean },
shortnessOfBreath: { type: Boolean },
cough: { type: Boolean },
address: { type: AddressModel.schema },
symptom: { type: SymptomModel.schema },
travelFrom: { type: String },
transitFrom: { type: String },
phoneNumber: { type: String },
flightNumber: { type: String },
selectedLanguage: { type: String },
language: { type: String },
contactWithSuspected: { type: Boolean },
contactWithConfirmed: { type: Boolean },
},
],
otherHotelName: { type: String },
Expand All @@ -46,7 +53,6 @@ const PassengerSchema = new Schema(
match: [/\S+@\S+\.\S+/, 'is invalid'],
},
language: { type: String },
fatigue: { type: Boolean },
underlyingConditions: {
chronicLungDisease: { type: Boolean },
heartDisease: { type: Boolean },
Expand All @@ -58,9 +64,6 @@ const PassengerSchema = new Schema(
hiv: { type: Boolean },
pregnancy: { type: Boolean },
},
haveSex: { type: Boolean },
animalMarket: { type: Boolean },
healthFacility: { type: Boolean },
},
{
timestamps: true,
Expand Down
32 changes: 14 additions & 18 deletions models/Surveillance.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const AddressModel = require('./Address');
const SymptomModel = require('./Symptom');

const SurveillanceSchema = new Schema(
{
firstName: { type: String, required: true, max: 100 },
middleName: { type: String, max: 100 },
lastName: { type: String, required: true, max: 100 },
nationality: { type: String },
email: { type: String },
sex: { type: String },
age: { type: Number },
region: { type: String },
subcity: { type: String },
zone: { type: String },
woreda: { type: String },
kebele: { type: String },
houseNumber: { type: String },
email: {
type: String,
lowercase: true,
match: [/\S+@\S+\.\S+/, 'is invalid'],
},
age: { type: Number, required: true },
sex: { type: String, required: true },
address: { type: AddressModel.schema },
symptom: { type: SymptomModel.schema },
phoneNumber: { type: String },
occupation: { type: String },
callDate: { type: Date },
callerType: { type: String },
fever: { type: Boolean },
cough: { type: Boolean },
headache: { type: Boolean },
runnyNose: { type: Boolean },
feelingUnwell: { type: Boolean },
shortnessOfBreath: { type: Boolean },
bodyPain: { type: Boolean },
travelHx: { type: Boolean },
haveSex: { type: Boolean },
animalMarket: { type: Boolean },
contactWithSuspected: { type: Boolean },
contactWithConfirmed: { type: Boolean },
healthFacility: { type: Boolean },
receiverName: { type: String },
source: { type: String },
Expand Down
15 changes: 15 additions & 0 deletions models/Symptom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const SymptomSchema = new Schema({
fever: { type: Boolean },
cough: { type: Boolean },
shortnessOfBreath: { type: Boolean },
fatigue: { type: Boolean },
headache: { type: Boolean },
runnyNose: { type: Boolean },
feelingUnwell: { type: Boolean },
});

// Export the model
module.exports = mongoose.model('Symptom', SymptomSchema);
62 changes: 11 additions & 51 deletions models/TollFree.js
Original file line number Diff line number Diff line change
@@ -1,70 +1,30 @@
const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const AddressModel = require('./Address');
const SymptomModel = require('./Symptom');

const TollFreeSchema = new Schema(
{
firstName: { type: String, required: true, max: 100 },
middleName: { type: String, max: 100 },
lastName: { type: String, required: true, max: 100 },
age: { type: Number },
sex: { type: String },
reportRegion: {
id: { type: Number },
name: { type: String },
},
region: {
id: { type: Number },
name: { type: String },
latitude: { type: Number },
longitude: { type: Number },
description: { type: String },
createdAt: { type: Date },
updatedAt: { type: Date },
deletedAt: { type: Date },
},
zone: {
id: { type: Number },
name: { type: String },
},
woreda: {
id: { type: Number },
name: { type: String },
},
city: {
id: { type: Number },
name: { type: String },
},
subcity: {
id: { type: Number },
name: { type: String },
},
kebele: {
id: { type: Number },
name: { type: String },
},
age: { type: Number, required: true },
sex: { type: String, required: true },
reportingFrom: { type: AddressModel.schema },
address: { type: AddressModel.schema },
symptom: { type: SymptomModel.schema },
createdBy: {
id: { type: Number },
firstName: { type: String, max: 100 },
firstName: { type: String, required: true, max: 100 },
middleName: { type: String, max: 100 },
lastName: { type: String, max: 100 },
lastName: { type: String, required: true, max: 100 },
email: {
type: String,
lowercase: true,
match: [/\S+@\S+\.\S+/, 'is invalid'],
},
phoneNumber: { type: String },
region: {
id: { type: Number },
firstName: { type: String, max: 100 },
middleName: { type: String, max: 100 },
lastName: { type: String, max: 100 },
email: {
type: String,
lowercase: true,
match: [/\S+@\S+\.\S+/, 'is invalid'],
},
phoneNumber: { type: String },
},
address: { type: AddressModel.schema },
role: {
id: { type: Number },
name: { type: String },
Expand Down

0 comments on commit de2ebe8

Please sign in to comment.