ideaconsult / Toxtree.js

http://ideaconsult.github.io/Toxtree.js/
2 stars 3 forks source link

Deleting `interpretation_result` from working matrix #188

Closed vedina closed 8 years ago

vedina commented 8 years ago

When deleting values from the working matrix jToxKit sends JSON request , identifying particular effect by idresult, as in the json below.

{
    "study": [{
        "owner": {
            "substance": {
                "uuid": "IUC4-b520d855-5138-47ce-97b3-09ddc933b744"
            }
        },
        "effects_to_delete": [{
            "result": {
                                "idresult" : 1234,  
                "deleted": true,
                "remarks": "Why this is deleted"
            }
        }]
    }]
}

However, some endpoints (e.g. skin sensitisation, skin irritation, eye irritation) are represented in the matrix by so called interpretation_result , which is a value on the level of protocol application, and not on the level of effect records (one protocol application may have multiple effect records). With the current setup it is impossible to remove the interpretation_result values, as the server receives a JSON like above, but without idresult and rightly fails.

@thejonan , @gonzomir , we need to brainstorm a mechanism to implement removal of interpretation_result values.

For testing, see the Skin sensitisation column in the working matrix

image

thejonan commented 8 years ago

I'm afraid most this is kind-of new for me. But, from looking the returned JSON for the working matrix - here's a small excerpt:

            "https://apps.ideaconsult.net/data/property/ECOTOX/EC_FISHTOX_SECTION/LC50/A3B07BB94F67A6CC3995A6E2AAEE4A59E2B35826/NOTSPECIFIED/54405305-ff3f-3a5d-bfe1-9a6ccb2a44c6": [{
                "loValue": 69.2,
                "idresult": 6297
            }
            ]
            ,
            "https://apps.ideaconsult.net/data/property/ECOTOX/EC_DAPHNIATOX_SECTION/interpretation_result/DE57FC30E942668EB956E51E0C5B38908CFBAFE3/NOTSPECIFIED/38723956-c5f9-3f5b-9256-8f1291747789": [{
                "textValue": "",
                "newentry": true
            }, {
                "textValue": "",
                "newentry": true
            }, {
                "textValue": "",
                "newentry": true
            }, {
                "textValue": "",
                "newentry": true
            }, {
                "textValue": "",
                "newentry": true
            }
            ]

Isn't it enough that the server just adds this idresult field to the interpretation_result-based entries?

vedina commented 8 years ago

Yes, it is new, we have overlooked it while implementing the matrix editing.

The thing is there is NO idresult for interpretation_result entries, it's in a different object. However, the document UUID is sufficient to identify it. (as in study.uuid here)

thejonan commented 8 years ago

But, as I see with other entries, idresult is unique among the array of values - how a particular entry would be identified without anything additional? By the index in the array? Why was not the same used for other effects then?

vedina commented 8 years ago

Yes, idresult is unique for effect records, it's just that interpretation_result is not stored within this array.

interpretation": {
"result": "not classified"
},
"effects": [
{
"endpoint": "LD50",
"conditions": {
"Sex": "male"
},
"result": {
"unit": "mg/kg bw",
"loQualifier": ">",
"loValue": 5000
}
},
{
"endpoint": "LD50",
"conditions": {
"Sex": "female"
},
"result": {
"unit": "mg/kg bw",
"loQualifier": ">",
"loValue": 2000,
"upQualifier": "<",
"upValue": 5000
}
}

Indeed, we can't identify where interpretation_result belongs to without anything additional, thus this request for brainstorming :)

Just have a thought - we can update the matrix JSON to include document_uuid as idresult entry for interpretation_result. Then the server side will figure out what to update.

Does jToxKit expect integer for the idresult, or will work with any scalar value? If later, then it needs only server side fix.

thejonan commented 8 years ago

No, it just copies the value. The only place idresult is present is this:

        self.edit.study.push({
          owner: { substance: { uuid: data.compound.i5uuid } },
          effects_to_delete: [{
            result: {
              idresult: data.values[featureId][valueIdx].idresult,
              deleted: true,
              remarks: reason
            },
          }]
        });

Btw, it is strange that nowhere else I can find idresult, which brings two questions:

Another thing is, that - we can rename effects_to_delete to something like studu_changes, to make it clear it is not effect-only.

vedina commented 8 years ago

No, let's not rename or change things now, we are already very late for a release. interpretation_result is kind of a summary of effects, not completely unrelated.

Will check the server side to answer the questions.

vedina commented 8 years ago

Fixed server side https://sourceforge.net/p/ambit/bugs/96/