ReferenceError: PersonSchema is not defined


#1

Hi there,

Please can someone assist, I’m getting the following error when I try and start my meteor app. Any help would be much appreciated. thank you

W20160827-08:53:24.672(2)? (STDERR) ReferenceError: PersonSchema is not defined
W20160827-08:53:24.673(2)? (STDERR) at meteorInstall.collections.person.js (collections/person.js:3:20)
W20160827-08:53:24.674(2)? (STDERR) at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:153:1)
W20160827-08:53:24.678(2)? (STDERR) at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:82:1)
W20160827-08:53:24.680(2)? (STDERR) at C:\newapp\Medex.meteor\local\build\programs\server\app\app.js:141:1
W20160827-08:53:24.680(2)? (STDERR) at C:\newapp\Medex.meteor\local\build\programs\server\boot.js:292:10
W20160827-08:53:24.681(2)? (STDERR) at Array.forEach (native)
W20160827-08:53:24.683(2)? (STDERR) at Function..each..forEach (C:\Users\jacqu\AppData\Local.meteor\packages\meteor-tool\1.4.1_1\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11)
W20160827-08:53:24.685(2)? (STDERR) at C:\newapp\Medex.meteor\local\build\programs\server\boot.js:128:5

routues.js

FlowRouter.route(’/PersonDetails’,{
name: ‘home’,
action(){
BlazeLayout.render(‘HomeLayout’);
}
});

FlowRouter.route(’/PersonDetails’,{
name: ‘Person Details’,
action(){
BlazeLayout.render(‘MainLayout’, {main: ‘Person’});
}
});

person.js

Person = new Meteor.Collection(‘person’);

PersonSchema = new PersonSchema({
FirstName: {
type: String,
label: “First Name”
},
LastName: {
type: String,
label: “Last Name”
},
IdentityNumber: {
type: Integer,
label: “Identity Number”
},
Address: {
type: String,
label: “Address”
},
PhoneNumber: {
type: Integer,
label: “Phone Number”
},
//User: {
//type: String,
//label: “User”,
//autoValue: function(){
// return this.userID
//}
//autoForm: {
// type: “hidden”
//}
//},
//createdAt: {
// type: Date,
// label: “Created At”,
// autoValue: function(){

//	}
//	autoForm: {
//		type: "hidden"
//},

});

Person.attachSchema(PersonSchema);


#2

if you’re using SimpleSchema this should work:

const PersonSchema = new SimpleSchema({...});

#3

Hi Chris,

Thanks for your assistance.

I am indeed using simple schema

I’ve asjusted my js accordingly but for some reason get a different error now

Person = new Meteor.Collection(‘person’);

const PersonSchema = new SimpleSchema({
FirstName: {
type: String,
label: “First Name”
},
LastName: {
type: String,
label: “Last Name”
},
IdentityNumber: {
type: Integer,
label: “Identity Number”
},
Address: {
type: String,
label: “Address”
},
PhoneNumber: {
type: Integer,
label: “Phone Number”
},
//User: {
//type: String,
//label: “User”,
//autoValue: function(){
// return this.userID
//}
//autoForm: {
// type: “hidden”
//}
//},
//createdAt: {
// type: Date,
// label: “Created At”,
// autoValue: function(){

//	}
//	autoForm: {
//		type: "hidden"
//},

});

Person.attachSchema(PersonSchema);

W20160827-13:39:37.715(2)? (STDERR) ReferenceError: Integer is not defined
W20160827-13:39:37.717(2)? (STDERR) at meteorInstall.collections.person.js (collections/person.js:13:9)
W20160827-13:39:37.720(2)? (STDERR) at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:153:1)
W20160827-13:39:37.722(2)? (STDERR) at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:82:1)
W20160827-13:39:37.724(2)? (STDERR) at C:\newapp\Medex.meteor\local\build\programs\server\app\app.js:141:1
W20160827-13:39:37.725(2)? (STDERR) at C:\newapp\Medex.meteor\local\build\programs\server\boot.js:292:10
W20160827-13:39:37.726(2)? (STDERR) at Array.forEach (native)
W20160827-13:39:37.727(2)? (STDERR) at Function..each..forEach (C:\Users\jacqu\AppData\Local.meteor\packages\meteor-tool\1.4.1_1\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11)
W20160827-13:39:37.731(2)? (STDERR) at C:\newapp\Medex.meteor\local\build\programs\server\boot.js:128:5


#4

type: Integer is not supported by SimpleSchema
check here for all supported types


#5

Clinical Meteor has a standards compliant PersonSchema, that is in use by major EMR vendors such as Epic and Cerner. See the package below for code samples:


#6

Ah, thanks so much, really appreciate the help


#7

thank you, thats very useful indeed


#8

I get the following error when I try and launch the app, not too sure why though.

any advice? thank you

While processing files with ecmascript (for target web.browser):
lib/hl7-resource-person.js:10:6: Unexpected token (10:6)

While processing files with ecmascript (for target os.windows.x86_32):
lib/hl7-resource-person.js:10:6: Unexpected token (10:6)


#9

You have ecmascript in your .meteor/packages file?


#10

yes i do, here is the contents of my package file

meteor-base@1.0.4 # Packages every Meteor app needs to have
mobile-experience@1.0.4 # Packages for a great mobile UX
mongo@1.1.12 # The database Meteor supports right now
blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views
reactive-var@1.0.10 # Reactive variable for tracker
jquery@1.11.9 # Helpful client-side library
tracker@1.1.0 # Meteor’s client-side reactive programming library

standard-minifier-css@1.2.0 # CSS minifier run for production mode
standard-minifier-js@1.2.0 # JS minifier run for production mode
es5-shim@4.6.14 # ECMAScript 5 compatibility for older browsers.
ecmascript@0.5.8 # Enable ECMAScript2015+ syntax in app code
shell-server@0.2.1 # Server-side component of the meteor shell command

autopublish@1.0.7 # Publish all data to the clients (for prototyping)
insecure@1.0.7 # Allow all DB writes from clients (for prototyping)
clinical:hl7-resource-person