You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 29, 2022. It is now read-only.
# code that belongs to the jsontableschema-models library
/{MODEL_LIB}/models.js // the base model class
/{MODEL_LIB}/query.js // the base query class
/{MODEL_LIB}/define.js // a helper function to define models
/{MODEL_LIB}/index.js // export the library
# code that belongs to the ebola code base
/{SRC}/models/
/{SRC}/models/trials.json // JSON Table Schema descriptor
/{SRC}/models/cases.json // JSON Table Schema descriptor
/{SRC}/models/trials.js // Model defintion
/{SRC}/models/cases.js // Model definition
/{SRC}/models/index.js // export all models, and also the query class from the lib
# models/trials.js
import define from 'jsontableschema-models'
const Trials = define({
resource: 'http://example.com/trials.csv', // path to the data source
descriptor: 'trials.json', // path to the jts descriptor
tableName: 'trials',
instanceMethods: {
// define custom instance methods here
},
classMethods: {
// define custom class methods here
}
})
module export Trials
# models/index.js
import { Query, connect } from 'jsontableschema-models'
import Trials from './trials'
import Cases from './cases'
// connect to/init storage
module exports {
Query,
Trials,
Cases
}
# querying
# there probably is a low-level API to query on the Storage itself
Storage.query('trials', 'find', {'id': 'SOME_ID'})
# a modified version on the models, that calls the lower-level one
Trials.query('find', {'id': 'SOME_ID'})
# and, possibly, a simplified API, that is not Storage dependent, and just implements some commons methods for collections of records
Query('trials').get(id={SOME_ID})
Query('trials').filter(type={SOME_TYPE})
Description
A POC for JSON Table Schema models: we develop it here in a real code + data environment, and then when we are happy with the API, we extract to https://github.com/frictionlessdata/jsontableschema-models-js and publish as a
v0.1
for object models using JTS.Proposal
References
Tasks
Storage
injsontableschema-js
along the lines of the Python implementation, with a default storage type ofmemory
, being an object in memorymemory
storage type, using lodashQuery
APIinit
/prerun
method that loads from the source tables into our data storage (likely, we call this when the server is loaded)The text was updated successfully, but these errors were encountered: