Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

analysis discussion #21

Open
maasencioh opened this issue Aug 29, 2017 · 1 comment
Open

analysis discussion #21

maasencioh opened this issue Aug 29, 2017 · 1 comment
Assignees

Comments

@maasencioh
Copy link
Contributor

analysis JSON

$id: [sampleId, viewUUID, label]
$content: {
    sample: [], // optional if only one
    viewRevision: '', //optional
    category: '', // optional
    description: '', // optional
    result: {
        data: [{}],
        preference: {}
    }
}

API

Init script

var Sample = await API.require('vh/eln/Sample');
var analysisManager = await API.require('vh/eln/analysis');
if (typeof IframeBridge !== 'undefined') {
    IframeBridge.onMessage(onMessage);
    IframeBridge.ready();
    function onMessage(data) {
        if (data.type === 'tab.data') {
            var sample = new Sample(data.message.couchDB, data.message.uuid, {track: false});
            var viewUUID = require('src/util/versioning').lastLoaded.view.url;
            var manager = await analysisManager(sample, viewUUID, 'category');
            // the variable analysis is created
            API.cache('analysisManager', manager);
        }
    }
}

Code executor

var analysisManager = API.cache('analysisManager');

// get or create a element to modify it
var analysis = await analysisManager.getByLabel('label');
var data = API.getData('label');
v.description = '';
data.result = {
    data: [{}],
    preference: {}
}
data.triggerChange;
analysis.save();

// list current analysis
var list = await analysisManager.getAll();
@lpatiny
Copy link
Member

lpatiny commented Aug 29, 2017

  • data: [{}], // the data result is rather free so it could be whatever, even just a number
  • preference is optional

I'm not sure we need to have a class for this. We could have static methods:

  • var analysisResult = analysisManager.load('label'); // empty object with the structure if does not exists
  • analysisManager.save('label', analysisResult); // replace if already exists
  • analysisManager.list();

@stropitek stropitek removed their assignment Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants