0.0.214 • Published 4 years ago

mgnlq_model v0.0.214

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

mgnlq_model Build StatusCoverage Status

model load and processing code

this will be slowly migrated to anychronous processing, separating the processes:

  1. metamodel building
  2. model index building for processing access
  3. rule index building
  4. data loading and validation

for a nested document

{$match:{"bar.text":"Hi"}}, {$unwind:"$bar"}, {$match:{"bar.text":"Hi"}}, {$group:{"_id":"$_id","bars":{$push:"$bar"}}}

Database used for testing containing data

(set up via node js/makedb.js or npm load_data ) mongodb://localhost/testdb'

Creating a database

via

node js/makedb.js

or

npm run load_testdb

to load the testdb2, use project mgnql_testmodel2 and npm run load_testdb2

a mongo db instance is created, The name of the DB and the source data is controlled via the environment parameters:

var mongoConnectionString = process.env.MONGO_DBURL || 'mongodb://localhost/testdb'; var modelPath = process.env.MGNLQ_MODELPATH || 'node_modules/mgnlq_testmodel/testmodel/';

recording the test queries

SET MONGO_TEST_RECORD=RECORD

run the tests -> data is created in node_modules/mgnql_testmodel_replay/mgrecrep/data

(typcially linked with npm link mgnlq_testmodel_replay ) This data must be checked in, the package version increased and published, subsequently the dependency has to be updated to allow running unit tests on travis etc.

Testing

The unit test use mongoose_record_replay and data in (npm module) mgnlq_testmodel_replay to be run without a mongoose instance.

Alternatively, by setting MONGO_TEST_RECORD='RECORD' Unit tests can be run against a mongodb installed on

'mongodb://localhost/testdb';

var mode = 'REPLAY';
if (process.env.MONGO_TEST_RECORD) {
  mode = 'RECORD';
}
var mongoose = require('mongoose_record_replay').instrumentMongoose(require('mongoose'),
  'node_modules/mgnlq_testmodel_replay/mgrecrep/',
  mode);

This DB must be filled with data, see

  nmp run load_data

to create the db from files

Cache file control

Model data is written and read from a cache file in modelPath unless MQNLQ_MODEL_NO_FILECACHE is set to true

TODO

  • Analyze model for mismatches in category aliases
 e.g.   DomainA   element name  synonyms: [  "element names", "elementname"]
        DomainB   element name  synonyms:[ "elements" ]

When this occurs a mismatch "elements" will match only DomainB,

  • Analyze model for casing mismatches, e.g.

abc => Abc abc => abc

test migration from nodenunit to jest

npm i -g jscodeshift
jscodeshift   --print -d 
0.0.214

4 years ago

0.0.213

4 years ago

0.0.212

4 years ago

0.0.25

4 years ago

0.0.211

4 years ago

0.0.24

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago