profile
viewpoint
Mohammed Eldadah mrdadah Gaza, Palestine

UniversalDataTool/universal-data-tool 857

Collaborate & label any type of data, images, text, or documents, in an easy web interface or desktop app.

mrdadah/frappe 0

Full Stack Web Framework in Python & JS. Used to build ERPNext

mrdadah/SuperAPI 0

Example API Server for the Gaza Sky Geeks Continuous Delivery Workshop

UniversalDataTool/collaboration-server 0

Collaboration Server for use with Universal Data Tool

create barnchUniversalDataTool/collaboration-server

branch : create-session

created branch time in 6 days

push eventUniversalDataTool/collaboration-server

Mohammed Eldadah

commit sha 81df889c573b88957cb2e467455141ce9a3fe862

summart mode schema adjustment

view details

Mohammed Eldadah

commit sha 8027eb4929dfec3df68d18a6e4b659db5f8d9e7d

Merge pull request #13 from UniversalDataTool/schema-adjustments summary mode schema adjustment

view details

push time in 8 days

create barnchUniversalDataTool/collaboration-server

branch : schema-adjustments

created branch time in 8 days

push eventUniversalDataTool/collaboration-server

Mohammed Eldadah

commit sha 66bfc670e9151ba9d26f2b8cb158c1214a73c416

support summary mode sequence diagram

view details

Mohammed Eldadah

commit sha db391332ec843025bab0fe4ee38bd72686397078

Merge branch 'dev' of https://github.com/UniversalDataTool/collaboration-server into dev

view details

push time in 13 days

push eventUniversalDataTool/collaboration-server

Mohammed Eldadah

commit sha 3c57b2a0cfeadb7861371a7b504a3959f05eeb42

change getSessionUDT to getSampleObject

view details

push time in 15 days

Pull request review commentUniversalDataTool/collaboration-server

Update samples instead of insert and delete

 module.exports = cors(async (req, res) => {     return error(res, 400, `Invalid ?since=${query(req).since}`)   } -  const sessionStmt = db.prepare('SELECT * FROM latest_session_state WHERE short_id = ? LIMIT 1');-  const session = sessionStmt.get(sessionId);+  const sessionStmt = db.prepare(+    "SELECT * FROM latest_session_state WHERE short_id = ? LIMIT 1"+  )+  const session = sessionStmt.get(sessionId)    if (!session) return error(res, 404, "Session Not Found") -  const samplesQueryResults = db.prepare(`SELECT  *-                           FROM latest_sample_state-                           WHERE session_short_id = ?`).all(session.short_id);+  const samplesQueryResults = db+    .prepare(+      ` SELECT  *+                                           FROM sample_state+                                           WHERE session_short_id = ?`+    )+    .all(session.short_id)    const samples = []-  samplesQueryResults.forEach(sample => {-    const content = JSON.parse(sample.content)-    const annotation = JSON.parse(sample.annotation)-    samples.push(Object.assign({}, content, {annotation}))+  samplesQueryResults.forEach((sample) => {+    const sessionUDT = getSessionUDT(sample)

renamed to getSampleObject

mrdadah

comment created time in 16 days

Pull request review commentUniversalDataTool/collaboration-server

Update samples instead of insert and delete

+const getSessionUDT = (sample) => {+  const content = JSON.parse(sample.content);+  const annotation = JSON.parse(sample.annotation);+  return { ...content, annotation };+};

done

mrdadah

comment created time in 16 days

Pull request review commentUniversalDataTool/collaboration-server

Support samples table

 module.exports = cors(async (req, res) => {     if (!body) return error(res, 400, "Need JSON body")     if (!body.patch) return error(res, 400, `Body should have "patch" key`) -    const stmt = db.prepare('SELECT * FROM latest_session_state WHERE short_id = ? LIMIT 1');-    const result = stmt.get(sessionId);+    const session = db.prepare('SELECT * FROM latest_session_state WHERE short_id = ? LIMIT 1').get(sessionId); -    if (!result) return error(res, 404, "Session Not Found")+    if (!session) return error(res, 404, "Session Not Found") -    let newJSON = {...JSON.parse(result.udt_json)}-    fjp.applyPatch(newJSON, body.patch)+    const samplePatches = body.patch.filter(patch => patch.path.includes('/samples'))+    const udtPatches = body.patch.filter(patch => !patch.path.includes('/samples')) -    const latestVersion = result.version + 1+    let newJSON = {...JSON.parse(session.udt_json)}+    fjp.applyPatch(newJSON, udtPatches)++    await patchSamples(session.short_id, samplePatches)+    const latestVersion = session.version + 1      const insertStmt = db.prepare(`         INSERT INTO session_state         (previous_session_state_id, short_id, user_name, patch, version, udt_json)         VALUES (?, ?, ?, ?, ?, ?)`);      insertStmt.run(-        result.session_state_id,+        session.session_state_id,         sessionId,         body.userName || null,         JSON.stringify(body.patch),         latestVersion,         JSON.stringify(newJSON)     ); +    const samplesQueryResults = db.prepare(`SELECT  *+                           FROM latest_sample_state+                           WHERE session_short_id = ?`).all(session.short_id);++    const samples = []+    samplesQueryResults.forEach(sample => {+        const content = JSON.parse(sample.content)+        const annotation = JSON.parse(sample.annotation)+        samples.push(Object.assign({}, content, {annotation}))+    })++    newJSON.samples = samples+     return send(res, 200, {latestVersion, hashOfLatestState: hash(newJSON)})+})++const patchCreateSamples = (async (sessionId, samplesToAdd) => {+    const samplesQueries = []+    if (samplesToAdd.length) {+        let sessionSampleId = -1+        const latestSample = db.prepare('SELECT * FROM sample_state WHERE session_short_id = ? ORDER BY session_sample_id DESC LIMIT 1').get(sessionId);+        if (latestSample) {+            sessionSampleId = parseInt(latestSample.session_sample_id)+        }++        samplesToAdd.forEach((sample) => {+            sessionSampleId += 1+            samplesQueries.push(db.prepare('INSERT INTO sample_state (session_short_id, session_sample_id, content) VALUES (?, ?, ?)').run(sessionId, sessionSampleId, JSON.stringify(sample)));+        })+    }+    return samplesQueries+})++const patchRemoveSamples = (async (sessionId, patches) => {+    if (patches.length) {+        await asyncForEach(patches, async (patch) => {+            const pathArray = patch.path.split('/')+            const indexToRemove = pathArray[2]++            await db.prepare('DELETE FROM sample_state WHERE session_short_id = ? AND session_sample_id = ? ').run(sessionId, indexToRemove);+            await db.prepare(`+                INSERT INTO sample_state +                    (session_short_id, session_sample_id, version, content, summary, annotation) +                SELECT +                    session_short_id, session_sample_id - 1, version + 1, content, summary, annotation+                FROM +                    latest_sample_state+                WHERE +                    session_short_id = ? AND session_sample_id > ?`).run(sessionId, indexToRemove);++            await db.prepare(`+                DELETE FROM sample_state +                WHERE sample_state_id IN (+                    SELECT sample_state_id+                    FROM sample_state+                    WHERE session_sample_id = (+                        SELECT session_sample_id+                        FROM latest_sample_state +                        WHERE session_short_id = ? +                        ORDER BY session_sample_id DESC +                        limit 1+                    )+                )`).run(sessionId);+        })+    }+})++const patchSamplesAnnotation = (async (sessionId, samplePatches) => {++    const sampleIds = {}+    samplePatches.forEach(patch => {+        const pathArray = patch.path.split('/')+        const sessionSampleId = pathArray[2]+        sampleIds[sessionSampleId] = {sessionSampleId}+    })++    const samplesArray = []+    const samples = db.prepare('SELECT * FROM latest_sample_state WHERE session_short_id = ? ORDER BY session_sample_id ASC').all(sessionId);

I need to get the same indexes so applyPatch would find and update the requested index

mrdadah

comment created time in 16 days

push eventUniversalDataTool/collaboration-server

Mohammed Eldadah

commit sha 8dedd02ff5745f501d6f4e6adacc4212c187110e

Update samples instead of insert and delete

view details

push time in 16 days

Pull request review commentUniversalDataTool/collaboration-server

Support samples table

 module.exports = cors(async (req, res) => {     if (!body) return error(res, 400, "Need JSON body")     if (!body.patch) return error(res, 400, `Body should have "patch" key`) -    const stmt = db.prepare('SELECT * FROM latest_session_state WHERE short_id = ? LIMIT 1');-    const result = stmt.get(sessionId);+    const session = db.prepare('SELECT * FROM latest_session_state WHERE short_id = ? LIMIT 1').get(sessionId); -    if (!result) return error(res, 404, "Session Not Found")+    if (!session) return error(res, 404, "Session Not Found") -    let newJSON = {...JSON.parse(result.udt_json)}-    fjp.applyPatch(newJSON, body.patch)+    const samplePatches = body.patch.filter(patch => patch.path.includes('/samples'))+    const udtPatches = body.patch.filter(patch => !patch.path.includes('/samples')) -    const latestVersion = result.version + 1+    let newJSON = {...JSON.parse(session.udt_json)}+    fjp.applyPatch(newJSON, udtPatches)++    await patchSamples(session.short_id, samplePatches)+    const latestVersion = session.version + 1      const insertStmt = db.prepare(`         INSERT INTO session_state         (previous_session_state_id, short_id, user_name, patch, version, udt_json)         VALUES (?, ?, ?, ?, ?, ?)`);      insertStmt.run(-        result.session_state_id,+        session.session_state_id,         sessionId,         body.userName || null,         JSON.stringify(body.patch),         latestVersion,         JSON.stringify(newJSON)     ); +    const samplesQueryResults = db.prepare(`SELECT  *+                           FROM latest_sample_state+                           WHERE session_short_id = ?`).all(session.short_id);++    const samples = []+    samplesQueryResults.forEach(sample => {+        const content = JSON.parse(sample.content)+        const annotation = JSON.parse(sample.annotation)+        samples.push(Object.assign({}, content, {annotation}))+    })++    newJSON.samples = samples+     return send(res, 200, {latestVersion, hashOfLatestState: hash(newJSON)})+})++const patchCreateSamples = (async (sessionId, samplesToAdd) => {+    const samplesQueries = []+    if (samplesToAdd.length) {+        let sessionSampleId = -1+        const latestSample = db.prepare('SELECT * FROM sample_state WHERE session_short_id = ? ORDER BY session_sample_id DESC LIMIT 1').get(sessionId);+        if (latestSample) {+            sessionSampleId = parseInt(latestSample.session_sample_id)+        }++        samplesToAdd.forEach((sample) => {+            sessionSampleId += 1+            samplesQueries.push(db.prepare('INSERT INTO sample_state (session_short_id, session_sample_id, content) VALUES (?, ?, ?)').run(sessionId, sessionSampleId, JSON.stringify(sample)));+        })+    }+    return samplesQueries+})++const patchRemoveSamples = (async (sessionId, patches) => {+    if (patches.length) {+        await asyncForEach(patches, async (patch) => {+            const pathArray = patch.path.split('/')+            const indexToRemove = pathArray[2]++            await db.prepare('DELETE FROM sample_state WHERE session_short_id = ? AND session_sample_id = ? ').run(sessionId, indexToRemove);+            await db.prepare(`+                INSERT INTO sample_state +                    (session_short_id, session_sample_id, version, content, summary, annotation) +                SELECT +                    session_short_id, session_sample_id - 1, version + 1, content, summary, annotation+                FROM +                    latest_sample_state+                WHERE +                    session_short_id = ? AND session_sample_id > ?`).run(sessionId, indexToRemove);++            await db.prepare(`+                DELETE FROM sample_state +                WHERE sample_state_id IN (+                    SELECT sample_state_id+                    FROM sample_state+                    WHERE session_sample_id = (+                        SELECT session_sample_id+                        FROM latest_sample_state +                        WHERE session_short_id = ? +                        ORDER BY session_sample_id DESC +                        limit 1+                    )+                )`).run(sessionId);+        })+    }+})++const patchSamplesAnnotation = (async (sessionId, samplePatches) => {++    const sampleIds = {}+    samplePatches.forEach(patch => {+        const pathArray = patch.path.split('/')+        const sessionSampleId = pathArray[2]+        sampleIds[sessionSampleId] = {sessionSampleId}+    })++    const samplesArray = []+    const samples = db.prepare('SELECT * FROM latest_sample_state WHERE session_short_id = ? ORDER BY session_sample_id ASC').all(sessionId);+    samples.forEach(sample => {+        const content = JSON.parse(sample.content)+        const annotation = JSON.parse(sample.annotation)+        samplesArray.push({+            ...content,+            annotation: annotation,+            version: parseInt(sample.version),+            session_sample_id: sample.session_sample_id+        })+    })+    let newJSON = {samples: samplesArray}+    fjp.applyPatch(newJSON, samplePatches)++    const queries = []+    Object.keys(sampleIds).forEach(sampleId => {+        const sample = samplesArray[sampleId]+        const session_sample_id = sample.session_sample_id+        const version = sample.version + 1+        const annotation = sample.annotation++        delete sample.session_sample_id+        delete sample.version+        delete sample.annotation++        queries.push(+            db.prepare('INSERT INTO sample_state (session_short_id, session_sample_id, version, annotation, content) VALUES (?, ?, ?, ?, ?)')+                .run(sessionId, session_sample_id, version, JSON.stringify(annotation), JSON.stringify(sample)));+    })++    return queries+})++const patchSamples = (async (sessionId, samplePatches) => {++    const samplesToAdd = []+    const samplesToRemove = []+    const samplesAnnotationPatches = []+    samplePatches.forEach(patch => {+        if (patch.op === 'add' && patch.path === '/samples/-') {

Right, will use/\/samples\//.test(patch.path)

mrdadah

comment created time in 16 days

Pull request review commentUniversalDataTool/collaboration-server

Support samples table

-const { send } = require("micro")+const {send} = require("micro") const cors = require("micro-cors")() const error = require("../../utils/error") const getDB = require('../db') const db = getDB({databasePath: 'udt.db', verbose: null})  module.exports = cors(async (req, res) => {-  const sessionId = req.params.session_id+    const sessionId = req.params.session_id -  const stmt = db.prepare(`SELECT  *+    const session = db.prepare(`SELECT  *                            FROM latest_session_state                            WHERE short_id = ?-                           LIMIT 1`);-  const result = stmt.get(sessionId);+                           LIMIT 1`).get(sessionId); -  if (!result) return error(res, 404, `Session "${sessionId}" Not Found`)+    if (!session) return error(res, 404, `Session "${sessionId}" Not Found`) -  result.udt_json = JSON.parse(result.udt_json)-  result.patch = JSON.parse(result.patch)-  return send(res, 200, result)+    const samplesQueryResults = db.prepare(`SELECT  *+                           FROM latest_sample_state+                           WHERE session_short_id = ?`).all(session.short_id);++    const samples = []+    samplesQueryResults.forEach(sample => {+        const content = JSON.parse(sample.content)+        const annotation = JSON.parse(sample.annotation)+        samples.push(Object.assign({}, content, {annotation}))+    })

done

mrdadah

comment created time in 16 days

Pull request review commentUniversalDataTool/collaboration-server

Support samples table

 module.exports = cors(async (req, res) => {     if (!body) return error(res, 400, "Need JSON body")     if (!body.patch) return error(res, 400, `Body should have "patch" key`) -    const stmt = db.prepare('SELECT * FROM latest_session_state WHERE short_id = ? LIMIT 1');-    const result = stmt.get(sessionId);+    const session = db.prepare('SELECT * FROM latest_session_state WHERE short_id = ? LIMIT 1').get(sessionId); -    if (!result) return error(res, 404, "Session Not Found")+    if (!session) return error(res, 404, "Session Not Found") -    let newJSON = {...JSON.parse(result.udt_json)}-    fjp.applyPatch(newJSON, body.patch)+    const samplePatches = body.patch.filter(patch => patch.path.includes('/samples'))+    const udtPatches = body.patch.filter(patch => !patch.path.includes('/samples')) -    const latestVersion = result.version + 1+    let newJSON = {...JSON.parse(session.udt_json)}+    fjp.applyPatch(newJSON, udtPatches)++    await patchSamples(session.short_id, samplePatches)+    const latestVersion = session.version + 1      const insertStmt = db.prepare(`         INSERT INTO session_state         (previous_session_state_id, short_id, user_name, patch, version, udt_json)         VALUES (?, ?, ?, ?, ?, ?)`);      insertStmt.run(-        result.session_state_id,+        session.session_state_id,         sessionId,         body.userName || null,         JSON.stringify(body.patch),         latestVersion,         JSON.stringify(newJSON)     ); +    const samplesQueryResults = db.prepare(`SELECT  *+                           FROM latest_sample_state+                           WHERE session_short_id = ?`).all(session.short_id);++    const samples = []+    samplesQueryResults.forEach(sample => {+        const content = JSON.parse(sample.content)+        const annotation = JSON.parse(sample.annotation)+        samples.push(Object.assign({}, content, {annotation}))+    })++    newJSON.samples = samples+     return send(res, 200, {latestVersion, hashOfLatestState: hash(newJSON)})+})++const patchCreateSamples = (async (sessionId, samplesToAdd) => {+    const samplesQueries = []+    if (samplesToAdd.length) {+        let sessionSampleId = -1+        const latestSample = db.prepare('SELECT * FROM sample_state WHERE session_short_id = ? ORDER BY session_sample_id DESC LIMIT 1').get(sessionId);+        if (latestSample) {+            sessionSampleId = parseInt(latestSample.session_sample_id)+        }++        samplesToAdd.forEach((sample) => {+            sessionSampleId += 1+            samplesQueries.push(db.prepare('INSERT INTO sample_state (session_short_id, session_sample_id, content) VALUES (?, ?, ?)').run(sessionId, sessionSampleId, JSON.stringify(sample)));+        })+    }+    return samplesQueries+})++const patchRemoveSamples = (async (sessionId, patches) => {+    if (patches.length) {

done

mrdadah

comment created time in 16 days

Pull request review commentUniversalDataTool/collaboration-server

Support samples table

 module.exports = cors(async (req, res) => {     if (!body) return error(res, 400, "Need JSON body")     if (!body.patch) return error(res, 400, `Body should have "patch" key`) -    const stmt = db.prepare('SELECT * FROM latest_session_state WHERE short_id = ? LIMIT 1');-    const result = stmt.get(sessionId);+    const session = db.prepare('SELECT * FROM latest_session_state WHERE short_id = ? LIMIT 1').get(sessionId); -    if (!result) return error(res, 404, "Session Not Found")+    if (!session) return error(res, 404, "Session Not Found") -    let newJSON = {...JSON.parse(result.udt_json)}-    fjp.applyPatch(newJSON, body.patch)+    const samplePatches = body.patch.filter(patch => patch.path.includes('/samples'))+    const udtPatches = body.patch.filter(patch => !patch.path.includes('/samples')) -    const latestVersion = result.version + 1+    let newJSON = {...JSON.parse(session.udt_json)}+    fjp.applyPatch(newJSON, udtPatches)++    await patchSamples(session.short_id, samplePatches)+    const latestVersion = session.version + 1      const insertStmt = db.prepare(`         INSERT INTO session_state         (previous_session_state_id, short_id, user_name, patch, version, udt_json)         VALUES (?, ?, ?, ?, ?, ?)`);      insertStmt.run(-        result.session_state_id,+        session.session_state_id,         sessionId,         body.userName || null,         JSON.stringify(body.patch),         latestVersion,         JSON.stringify(newJSON)     ); +    const samplesQueryResults = db.prepare(`SELECT  *+                           FROM latest_sample_state+                           WHERE session_short_id = ?`).all(session.short_id);++    const samples = []+    samplesQueryResults.forEach(sample => {+        const content = JSON.parse(sample.content)+        const annotation = JSON.parse(sample.annotation)+        samples.push(Object.assign({}, content, {annotation}))+    })++    newJSON.samples = samples+     return send(res, 200, {latestVersion, hashOfLatestState: hash(newJSON)})+})++const patchCreateSamples = (async (sessionId, samplesToAdd) => {+    const samplesQueries = []+    if (samplesToAdd.length) {+        let sessionSampleId = -1+        const latestSample = db.prepare('SELECT * FROM sample_state WHERE session_short_id = ? ORDER BY session_sample_id DESC LIMIT 1').get(sessionId);+        if (latestSample) {+            sessionSampleId = parseInt(latestSample.session_sample_id)+        }++        samplesToAdd.forEach((sample) => {+            sessionSampleId += 1+            samplesQueries.push(db.prepare('INSERT INTO sample_state (session_short_id, session_sample_id, content) VALUES (?, ?, ?)').run(sessionId, sessionSampleId, JSON.stringify(sample)));+        })+    }+    return samplesQueries+})++const patchRemoveSamples = (async (sessionId, patches) => {+    if (patches.length) {+        await asyncForEach(patches, async (patch) => {

done

mrdadah

comment created time in 16 days

Pull request review commentUniversalDataTool/collaboration-server

Support samples table

 module.exports = cors(async (req, res) => {     if (!body) return error(res, 400, "Need JSON body")     if (!body.patch) return error(res, 400, `Body should have "patch" key`) -    const stmt = db.prepare('SELECT * FROM latest_session_state WHERE short_id = ? LIMIT 1');-    const result = stmt.get(sessionId);+    const session = db.prepare('SELECT * FROM latest_session_state WHERE short_id = ? LIMIT 1').get(sessionId); -    if (!result) return error(res, 404, "Session Not Found")+    if (!session) return error(res, 404, "Session Not Found") -    let newJSON = {...JSON.parse(result.udt_json)}-    fjp.applyPatch(newJSON, body.patch)+    const samplePatches = body.patch.filter(patch => patch.path.includes('/samples'))+    const udtPatches = body.patch.filter(patch => !patch.path.includes('/samples')) -    const latestVersion = result.version + 1+    let newJSON = {...JSON.parse(session.udt_json)}+    fjp.applyPatch(newJSON, udtPatches)++    await patchSamples(session.short_id, samplePatches)+    const latestVersion = session.version + 1      const insertStmt = db.prepare(`         INSERT INTO session_state         (previous_session_state_id, short_id, user_name, patch, version, udt_json)         VALUES (?, ?, ?, ?, ?, ?)`);      insertStmt.run(-        result.session_state_id,+        session.session_state_id,         sessionId,         body.userName || null,         JSON.stringify(body.patch),         latestVersion,         JSON.stringify(newJSON)     ); +    const samplesQueryResults = db.prepare(`SELECT  *+                           FROM latest_sample_state+                           WHERE session_short_id = ?`).all(session.short_id);++    const samples = []+    samplesQueryResults.forEach(sample => {+        const content = JSON.parse(sample.content)+        const annotation = JSON.parse(sample.annotation)+        samples.push(Object.assign({}, content, {annotation}))+    })++    newJSON.samples = samples+     return send(res, 200, {latestVersion, hashOfLatestState: hash(newJSON)})+})++const patchCreateSamples = (async (sessionId, samplesToAdd) => {+    const samplesQueries = []+    if (samplesToAdd.length) {+        let sessionSampleId = -1+        const latestSample = db.prepare('SELECT * FROM sample_state WHERE session_short_id = ? ORDER BY session_sample_id DESC LIMIT 1').get(sessionId);+        if (latestSample) {+            sessionSampleId = parseInt(latestSample.session_sample_id)+        }++        samplesToAdd.forEach((sample) => {+            sessionSampleId += 1+            samplesQueries.push(db.prepare('INSERT INTO sample_state (session_short_id, session_sample_id, content) VALUES (?, ?, ?)').run(sessionId, sessionSampleId, JSON.stringify(sample)));+        })+    }+    return samplesQueries+})++const patchRemoveSamples = (async (sessionId, patches) => {+    if (patches.length) {+        await asyncForEach(patches, async (patch) => {+            const pathArray = patch.path.split('/')+            const indexToRemove = pathArray[2]++            await db.prepare('DELETE FROM sample_state WHERE session_short_id = ? AND session_sample_id = ? ').run(sessionId, indexToRemove);+            await db.prepare(`+                INSERT INTO sample_state +                    (session_short_id, session_sample_id, version, content, summary, annotation) +                SELECT +                    session_short_id, session_sample_id - 1, version + 1, content, summary, annotation+                FROM +                    latest_sample_state+                WHERE +                    session_short_id = ? AND session_sample_id > ?`).run(sessionId, indexToRemove);++            await db.prepare(`+                DELETE FROM sample_state +                WHERE sample_state_id IN (+                    SELECT sample_state_id+                    FROM sample_state+                    WHERE session_sample_id = (+                        SELECT session_sample_id+                        FROM latest_sample_state +                        WHERE session_short_id = ? +                        ORDER BY session_sample_id DESC +                        limit 1+                    )+                )`).run(sessionId);+        })+    }+})++const patchSamplesAnnotation = (async (sessionId, samplePatches) => {++    const sampleIds = {}+    samplePatches.forEach(patch => {+        const pathArray = patch.path.split('/')+        const sessionSampleId = pathArray[2]+        sampleIds[sessionSampleId] = {sessionSampleId}+    })++    const samplesArray = []+    const samples = db.prepare('SELECT * FROM latest_sample_state WHERE session_short_id = ? ORDER BY session_sample_id ASC').all(sessionId);+    samples.forEach(sample => {+        const content = JSON.parse(sample.content)+        const annotation = JSON.parse(sample.annotation)+        samplesArray.push({+            ...content,+            annotation: annotation,+            version: parseInt(sample.version),+            session_sample_id: sample.session_sample_id+        })+    })+    let newJSON = {samples: samplesArray}+    fjp.applyPatch(newJSON, samplePatches)++    const queries = []+    Object.keys(sampleIds).forEach(sampleId => {+        const sample = samplesArray[sampleId]+        const session_sample_id = sample.session_sample_id+        const version = sample.version + 1+        const annotation = sample.annotation++        delete sample.session_sample_id+        delete sample.version+        delete sample.annotation++        queries.push(+            db.prepare('INSERT INTO sample_state (session_short_id, session_sample_id, version, annotation, content) VALUES (?, ?, ?, ?, ?)')+                .run(sessionId, session_sample_id, version, JSON.stringify(annotation), JSON.stringify(sample)));

yup

mrdadah

comment created time in 16 days

Pull request review commentUniversalDataTool/collaboration-server

Support samples table

 module.exports = cors(async (req, res) => {     if (!body) return error(res, 400, "Need JSON body")     if (!body.patch) return error(res, 400, `Body should have "patch" key`) -    const stmt = db.prepare('SELECT * FROM latest_session_state WHERE short_id = ? LIMIT 1');-    const result = stmt.get(sessionId);+    const session = db.prepare('SELECT * FROM latest_session_state WHERE short_id = ? LIMIT 1').get(sessionId); -    if (!result) return error(res, 404, "Session Not Found")+    if (!session) return error(res, 404, "Session Not Found") -    let newJSON = {...JSON.parse(result.udt_json)}-    fjp.applyPatch(newJSON, body.patch)+    const samplePatches = body.patch.filter(patch => patch.path.includes('/samples'))+    const udtPatches = body.patch.filter(patch => !patch.path.includes('/samples')) -    const latestVersion = result.version + 1+    let newJSON = {...JSON.parse(session.udt_json)}+    fjp.applyPatch(newJSON, udtPatches)++    await patchSamples(session.short_id, samplePatches)+    const latestVersion = session.version + 1      const insertStmt = db.prepare(`         INSERT INTO session_state         (previous_session_state_id, short_id, user_name, patch, version, udt_json)         VALUES (?, ?, ?, ?, ?, ?)`);      insertStmt.run(-        result.session_state_id,+        session.session_state_id,         sessionId,         body.userName || null,         JSON.stringify(body.patch),         latestVersion,         JSON.stringify(newJSON)     ); +    const samplesQueryResults = db.prepare(`SELECT  *+                           FROM latest_sample_state+                           WHERE session_short_id = ?`).all(session.short_id);++    const samples = []+    samplesQueryResults.forEach(sample => {+        const content = JSON.parse(sample.content)+        const annotation = JSON.parse(sample.annotation)+        samples.push(Object.assign({}, content, {annotation}))+    })++    newJSON.samples = samples+     return send(res, 200, {latestVersion, hashOfLatestState: hash(newJSON)})+})++const patchCreateSamples = (async (sessionId, samplesToAdd) => {+    const samplesQueries = []+    if (samplesToAdd.length) {+        let sessionSampleId = -1+        const latestSample = db.prepare('SELECT * FROM sample_state WHERE session_short_id = ? ORDER BY session_sample_id DESC LIMIT 1').get(sessionId);+        if (latestSample) {+            sessionSampleId = parseInt(latestSample.session_sample_id)+        }++        samplesToAdd.forEach((sample) => {+            sessionSampleId += 1+            samplesQueries.push(db.prepare('INSERT INTO sample_state (session_short_id, session_sample_id, content) VALUES (?, ?, ?)').run(sessionId, sessionSampleId, JSON.stringify(sample)));+        })+    }+    return samplesQueries+})++const patchRemoveSamples = (async (sessionId, patches) => {+    if (patches.length) {+        await asyncForEach(patches, async (patch) => {+            const pathArray = patch.path.split('/')+            const indexToRemove = pathArray[2]++            await db.prepare('DELETE FROM sample_state WHERE session_short_id = ? AND session_sample_id = ? ').run(sessionId, indexToRemove);+            await db.prepare(`+                INSERT INTO sample_state +                    (session_short_id, session_sample_id, version, content, summary, annotation) +                SELECT +                    session_short_id, session_sample_id - 1, version + 1, content, summary, annotation+                FROM +                    latest_sample_state+                WHERE +                    session_short_id = ? AND session_sample_id > ?`).run(sessionId, indexToRemove);++            await db.prepare(`+                DELETE FROM sample_state +                WHERE sample_state_id IN (+                    SELECT sample_state_id+                    FROM sample_state+                    WHERE session_sample_id = (+                        SELECT session_sample_id+                        FROM latest_sample_state +                        WHERE session_short_id = ? +                        ORDER BY session_sample_id DESC +                        limit 1+                    )+                )`).run(sessionId);+        })+    }+})++const patchSamplesAnnotation = (async (sessionId, samplePatches) => {++    const sampleIds = {}+    samplePatches.forEach(patch => {+        const pathArray = patch.path.split('/')+        const sessionSampleId = pathArray[2]+        sampleIds[sessionSampleId] = {sessionSampleId}+    })++    const samplesArray = []+    const samples = db.prepare('SELECT * FROM latest_sample_state WHERE session_short_id = ? ORDER BY session_sample_id ASC').all(sessionId);+    samples.forEach(sample => {+        const content = JSON.parse(sample.content)+        const annotation = JSON.parse(sample.annotation)+        samplesArray.push({+            ...content,+            annotation: annotation,+            version: parseInt(sample.version),+            session_sample_id: sample.session_sample_id+        })+    })+    let newJSON = {samples: samplesArray}+    fjp.applyPatch(newJSON, samplePatches)++    const queries = []+    Object.keys(sampleIds).forEach(sampleId => {

done

mrdadah

comment created time in 16 days

Pull request review commentUniversalDataTool/collaboration-server

Support samples table

 module.exports = cors(async (req, res) => {    if (!session) return error(res, 404, "Session Not Found") +  const samplesQueryResults = db.prepare(`SELECT  *+                           FROM latest_sample_state+                           WHERE session_short_id = ?`).all(session.short_id);++  const samples = []+  samplesQueryResults.forEach(sample => {+    const content = JSON.parse(sample.content)+    const annotation = JSON.parse(sample.annotation)+    samples.push(Object.assign({}, content, {annotation}))

Cool

mrdadah

comment created time in 16 days

Pull request review commentUniversalDataTool/collaboration-server

Support samples table

 module.exports = (db) => {             GROUP BY                  short_id;                 +        CREATE TABLE IF NOT EXISTS sample_state (+            sample_state_id INTEGER PRIMARY KEY AUTOINCREMENT,+            session_short_id TEXT NOT NULL,   +            session_sample_id INTEGER NOT NULL,     +            version INTEGER NOT NULL DEFAULT 0,+            content TEXT NOT NULL,+            summary TEXT,+            annotation TEXT,+            created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP+        );+        +        CREATE VIEW IF NOT EXISTS latest_sample_state AS+            SELECT +                *+            FROM +                (+                  select *+                        from sample_state+                        order by sample_state_id DESC+                  ) as sample_state+            GROUP BY +                session_short_id, session_sample_id;

done

mrdadah

comment created time in 16 days

create barnchUniversalDataTool/collaboration-server

branch : dev

created branch time in 19 days

push eventUniversalDataTool/collaboration-server

Mohammed Eldadah

commit sha 022c436e6e4a3da7550d0fdd2f8f8d8ec51af615

Create delete patch session test & fix remove sample issue

view details

push time in 21 days

push eventUniversalDataTool/collaboration-server

Mohammed Eldadah

commit sha 4a0fd69ce9ef973fd3cb7d4f3d76c885d4dafa00

fix remove sample issue

view details

push time in 22 days

push eventUniversalDataTool/collaboration-server

Mohammed Eldadah

commit sha d409df2adf1261d82a4503c227e280b8c65f3f78

implelemt patchCreatSamples function

view details

push time in 25 days

push eventUniversalDataTool/collaboration-server

Mohammed Eldadah

commit sha 93ea9b4915c5fc3645e51fcd7893d4a4cabcab20

updates

view details

push time in a month

create barnchUniversalDataTool/collaboration-server

branch : support-samples-table

created branch time in a month

push eventUniversalDataTool/universal-data-tool

Mohammed Eldadah

commit sha c79979b6ef90703c95aa0969db8faca0ae4da87d

implement analytics for label help button & dialogs

view details

Mohammed Eldadah

commit sha 7cac9fe93f6f633a9234ab99fb5d72a4b2ac1885

fix prettier & lint

view details

Mohammed Eldadah

commit sha e77c96bd762567d18550ca1c75e04e6d2f9a0b15

use lower case in posthog events

view details

Mohammed Eldadah

commit sha 798cc45620c90403fdf45c91da089f42d006c57e

Merge pull request #222 from UniversalDataTool/label-help-analytics fix: Create event analytics for Label help actions

view details

push time in a month

delete branch UniversalDataTool/universal-data-tool

delete branch : label-help-analytics

delete time in a month

push eventUniversalDataTool/universal-data-tool

Mohammed Eldadah

commit sha e77c96bd762567d18550ca1c75e04e6d2f9a0b15

use lower case in posthog events

view details

push time in a month

startedtuvtran/project-based-learning

started time in a month

started30-seconds/30-seconds-of-code

started time in a month

startedhoanhan101/ultimate-go

started time in a month

push eventUniversalDataTool/universal-data-tool

Tamay Eser Uysal

commit sha 57b703e8d1b17b49ea91b6438a74fe854e923126

Add French translation Fix JSON file

view details

Tamay Eser Uysal

commit sha 97ee06cb26b858d2c753c351a1eca4de88a18e08

Make branch prettier

view details

Puskuruk

commit sha f15a439087cca07d0e9ea87a73cde1042ef6f1ee

Merge branch 'master' into translation/french

view details

Mohammed Eldadah

commit sha 13ec38e10787a45ee736ecc663fd4f02e099ce65

fix: Merge pull request #220 from UniversalDataTool/translation/french French translation

view details

push time in a month

delete branch UniversalDataTool/universal-data-tool

delete branch : translation/french

delete time in a month

push eventUniversalDataTool/universal-data-tool

Tamay Eser Uysal

commit sha 3a278c1fe3e679faf684324c65a542ab0ffa5a10

Add chinese translation

view details

Tamay Eser Uysal

commit sha 2aefb9d40e4346baa394fd63eb4fae8850cc5da9

Make branch prettier

view details

Mohammed Eldadah

commit sha 1c2d458e562061dd8819dc17c95fcf02a5be1b17

fix: Merge pull request #219 from UniversalDataTool/translation/chinese Chinese translation

view details

push time in a month

delete branch UniversalDataTool/universal-data-tool

delete branch : translation/chinese

delete time in a month

push eventUniversalDataTool/universal-data-tool

Mohammed Eldadah

commit sha 7cac9fe93f6f633a9234ab99fb5d72a4b2ac1885

fix prettier & lint

view details

push time in a month

create barnchUniversalDataTool/universal-data-tool

branch : label-help-analytics

created branch time in a month

push eventUniversalDataTool/universal-data-tool

Mohammed Eldadah

commit sha 34e049f90fb1da44b2cfd35ef66bc04a4fce4b66

implement workspace layout in image classification component

view details

Mohammed Eldadah

commit sha 3ed67bcceaf104bfdcbd3abd901b934ee784b23c

resolve conflict

view details

Mohammed Eldadah

commit sha 792ebdfe32f038f997babab6bfb42c4e87d9bbd7

fix lint issues

view details

Mohammed Eldadah

commit sha 526a7e5316a841eba43a585fb5e0c30f9de4f513

run npm install to sync package and package.lock version

view details

Mohammed Eldadah

commit sha 38a317d9d248a2d210d3289146b3e788fe5838cf

remove unused package @material-ui/utils

view details

Mohammed Eldadah

commit sha 646c61139b67696660335de088a1adb2e43acc18

fix: Merge pull request #218 from UniversalDataTool/image-classification-workspace-layout implement workspace layout in image classification component

view details

push time in a month

delete branch UniversalDataTool/universal-data-tool

delete branch : image-classification-workspace-layout

delete time in a month

Pull request review commentUniversalDataTool/universal-data-tool

implement workspace layout in image classification component

   },   "dependencies": {     "@material-ui/styles": "^4.9.0",+    "@material-ui/utils": "^4.10.2",

Yeah it's not used, not sure when I added it :\

mrdadah

comment created time in a month

push eventUniversalDataTool/universal-data-tool

Mohammed Eldadah

commit sha 38a317d9d248a2d210d3289146b3e788fe5838cf

remove unused package @material-ui/utils

view details

push time in a month

push eventUniversalDataTool/universal-data-tool

Mohammed Eldadah

commit sha 526a7e5316a841eba43a585fb5e0c30f9de4f513

run npm install to sync package and package.lock version

view details

push time in a month

push eventUniversalDataTool/universal-data-tool

Mohammed Eldadah

commit sha 792ebdfe32f038f997babab6bfb42c4e87d9bbd7

fix lint issues

view details

push time in a month

push eventUniversalDataTool/universal-data-tool

seveibar

commit sha beb8bd44d3ca18b778827fd7d21d0e450a1405b5

fix table view not displaying annotations, fix storybook errors, more reliable hotkeys, clear hotkeys

view details

Tamay Eser Uysal

commit sha 0edb5191e9cbaf7df377bd5ab1d176927eba4b3f

Created full page loading animation

view details

Tamay Eser Uysal

commit sha 1db35d04fcdf6916fc4d232746245c7bc156621b

Added packages for internalization

view details

Tamay Eser Uysal

commit sha c83068f0e14d375d52928efb0c968dbd8a3fbf2b

Internationalized :flag:

view details

Tamay Eser Uysal

commit sha 472124fad1a0e8a13dde5552ab627b565ec591e7

solved dependency issue

view details

Tamay Eser Uysal

commit sha ec81b426f50da18e8c77efae2a0ed8dfe94b07ff

Made branch prettier

view details

seveibar

commit sha 7cb1a44dc534702be1cc563e6e3bf0fb7a13aa56

fix table view not displaying annotations, fix storybook errors, more reliable hotkeys, clear hotkeys

view details

Tamay Eser Uysal

commit sha ac69b275c3631bd7d6916f2a60c714b77e4fbcc5

Fix mutation problem with ConfigureImageSegmentation

view details

seveibar

commit sha c68909416fb28d99f8c12ecd042a801d16ee9246

fix eslint issues, add strict mode, remove http backend

view details

seveibar

commit sha 6403af39d772b5f9bcb63eba14621845a2216316

typo fix, reintroduce icons

view details

seveibar

commit sha 9c9922e4fa2ecfa531069c73235e2d2bcd7a44d3

remove http backend

view details

seveibar

commit sha db6aa45236410ed97c24147ce6a89614c0e23c02

run prettier

view details

seveibar

commit sha 74008989d7b108219eb1882d5c9db8977e51066d

docker container

view details

seveibar

commit sha b8e756f1db507bd48b25a2c89197d87d2bed0c9a

add docker readme instructions

view details

Mohammed Eldadah

commit sha 105cd0895347acd6893f0624e625698509f953d1

Merge pull request #216 from UniversalDataTool/feat/docker-container Docker Container

view details

Severin Ibarluzea

commit sha 0eef94eefd5e0abed494e2905a5c64dbf57b42c0

fix: Merge pull request #215 from UniversalDataTool/feature/i18n-2 Internationalization rebased, removed http backend replaced with static backend

view details

semantic-release-bot

commit sha 44c76e4ffebf998414cc1d00a17a162921bb5f5d

chore(release): 0.10.26 [skip ci] ## [0.10.26](https://github.com/UniversalDataTool/universal-data-tool/compare/v0.10.25...v0.10.26) (2020-06-29) ### Bug Fixes * Merge pull request [#215](https://github.com/UniversalDataTool/universal-data-tool/issues/215) from UniversalDataTool/feature/i18n-2 ([0eef94e](https://github.com/UniversalDataTool/universal-data-tool/commit/0eef94eefd5e0abed494e2905a5c64dbf57b42c0))

view details

Mohammed Eldadah

commit sha 3ed67bcceaf104bfdcbd3abd901b934ee784b23c

resolve conflict

view details

push time in a month

delete branch UniversalDataTool/universal-data-tool

delete branch : feat/docker-container

delete time in a month

push eventUniversalDataTool/universal-data-tool

seveibar

commit sha 74008989d7b108219eb1882d5c9db8977e51066d

docker container

view details

seveibar

commit sha b8e756f1db507bd48b25a2c89197d87d2bed0c9a

add docker readme instructions

view details

Mohammed Eldadah

commit sha 105cd0895347acd6893f0624e625698509f953d1

Merge pull request #216 from UniversalDataTool/feat/docker-container Docker Container

view details

push time in a month

PR merged UniversalDataTool/universal-data-tool

Docker Container

Run the web app with docker run -it -p 3000:3000 universaldatatool/universaldatatool

+20 -1

1 comment

3 changed files

seveibar

pr closed time in a month

push eventUniversalDataTool/collaboration-server

Mohammed Eldadah

commit sha be6126ad2b74c51a4c39b5a6918709f7dbed8a03

update dockerFile

view details

push time in a month

create barnchUniversalDataTool/collaboration-server

branch : create-docker

created branch time in a month

push eventUniversalDataTool/universal-data-tool

Mohammed Eldadah

commit sha d2e0503c3a44fc96539b82690c3adb3d8e162907

skip broken Cypress test

view details

push time in a month

push eventUniversalDataTool/universal-data-tool

seveibar

commit sha b622cda22b6a2e377e2cb3fb6f8593b890ff23be

fix broken collaborative sessions

view details

seveibar

commit sha 16bfdf31a24627e1fff6ac8ff06a4506b624b745

remove log

view details

seveibar

commit sha 5478eb64e45af40245b5408a633943b5c19abd48

added optional chaining, better start:desktop script, fix for new file on desktop

view details

Severin Ibarluzea

commit sha 78f2239b74589c4e445a9c48817f7c01cae6cd07

fix: Merge pull request #193 from UniversalDataTool/small-fixes Fix Join Collaborative Session, Open File on Desktop

view details

seveibar

commit sha 81299a35f685af062a89b7b64b5d30b3c0c73712

removed unnecessary babel plugin (was breaking lib build)

view details

Severin Ibarluzea

commit sha ba7c1f2c8513e36b451a3c6a1d82d6beb3332fc0

fix: Merge pull request #194 from UniversalDataTool/fix/build-lib removed unnecessary babel plugin (was breaking lib build)

view details

semantic-release-bot

commit sha c409bc717377d1212c6e7dc70df8533d3a873250

chore(release): 0.10.20 [skip ci] ## [0.10.20](https://github.com/UniversalDataTool/universal-data-tool/compare/v0.10.19...v0.10.20) (2020-06-15) ### Bug Fixes * Merge pull request [#193](https://github.com/UniversalDataTool/universal-data-tool/issues/193) from UniversalDataTool/small-fixes ([78f2239](https://github.com/UniversalDataTool/universal-data-tool/commit/78f2239b74589c4e445a9c48817f7c01cae6cd07)) * Merge pull request [#194](https://github.com/UniversalDataTool/universal-data-tool/issues/194) from UniversalDataTool/fix/build-lib ([ba7c1f2](https://github.com/UniversalDataTool/universal-data-tool/commit/ba7c1f2c8513e36b451a3c6a1d82d6beb3332fc0))

view details

seveibar

commit sha 467de1d683738c2ce23e67a21e148c5f7e7c6930

initial full segmentation

view details

seveibar

commit sha bce0b23fd2fcdf1199416a3d65646bffc07b0a60

introduce allowedArea

view details

seveibar

commit sha 6412a3e0fd34e642b70b77905ebaa64c4181adee

update package lock to try to fix bogus ci issue

view details

x213212

commit sha c842bbf4886b8880d1e84552da5e83503bdfbdac

x213212 fix google drive

view details

x213212

commit sha 0a51950a003ae4b8957d3530bf50eb3d7163133c

x213212 fix google drive

view details

seveibar

commit sha 52651d02513418f505828794967f23002e4bb262

make scripts work for npm packages

view details

allcontributors[bot]

commit sha ab407dfc67d32bf92ce326cbc07b58a70c147b69

docs: update README.md [skip ci]

view details

allcontributors[bot]

commit sha 0735c9a8da10c47450ef9e42e0c4bd2de6bab343

docs: update .all-contributorsrc [skip ci]

view details

allcontributors[bot]

commit sha 8b58e6dd0bdde3c862d2bd51e0c3316e44b83bd6

docs: update README.md [skip ci]

view details

allcontributors[bot]

commit sha b3badcdcc55bfa4178af7d5c36186c90b98dac8a

docs: update .all-contributorsrc [skip ci]

view details

seveibar

commit sha 4a8ac50ff010e0649304e71d6ecf421b72f77a4a

fixed bad http dep

view details

Severin Ibarluzea

commit sha 453b34af7e1bc57d17a9a2bfc57efc86d385e88a

Merge pull request #195 from UniversalDataTool/feat/full-segmentation Introduce Full Segmentation

view details

allcontributors[bot]

commit sha 7f35cba99a41cff3aa565ccfb181fc5d570b5c56

docs: update README.md [skip ci]

view details

push time in a month

push eventUniversalDataTool/universal-data-tool

Mohammed Eldadah

commit sha da1258552aaad56fecaf7432cbcdeb45ca26ae2a

run prettier

view details

push time in 2 months

startedUniversalDataTool/universal-data-tool

started time in 2 months

startedgre/react-native-view-shot

started time in 2 months

startedreact-native-kit/react-native-track-player

started time in 3 months

startediyegoroff/react-native-image-filter-kit

started time in 3 months

startedGregoryNative/react-native-gl-image-filters

started time in 3 months

startedgre/gl-react-v2

started time in 3 months

more