Connecting test name and its associated test value when pulling information from QATrack+ API

67 views
Skip to first unread message

min yang

unread,
Apr 16, 2021, 1:55:32 PM4/16/21
to QATrack+
Hi everyone,            

            Are there a way to connect test name with input test value when extracting information from QATrack+ API? From API, under Test Instance List, there is a “json_value” associated with each Test instance, it’s “null” for all the tests. Could we generate a value or string to replace the “null”?



Thank you

Min

Randle Taylor

unread,
Apr 16, 2021, 7:05:10 PM4/16/21
to min yang, QATrack+
To get the test associated with a test instance, you need to fetch the associated unit_test_info record, then from that fetch the associated test record from that.  So if your json object for your test instance looks like:
    ...
    "value": 564.0,
    "string_value": null,
    "date_value": null,
    "datetime_value": null,
    "json_value": null,
    ....
    "unit_test_info": "http://127.0.0.1:8000/api/qc/unittestinfos/19/",
    ...
}

Then you need to fetch the unit_test_info url which will return a json object like:


and then you can fetch the test record which will allow you to grab the name:

{
    "url": "http://127.0.0.1:8000/api/qc/tests/19/",
    "name": "100 kVp Cone D, Filter F3, 30 MU",
    "display_name": "",
    "slug": "f3d",
    "description": "",
    "procedure": "",
    "chart_visibility": true,
    ...
}

Typically if you want the value of the test, you will use the 'value' attribute for numerical results, or the "string_value" for string type tests. 

This does require quite a few requests to the server when fetching data for lots of test lists instances so you may want to cache some of the results (e.g. the test name results for a given unit_test_info) if you're fetching lots of data.

Hope that helps,
Randy

--
You received this message because you are subscribed to the Google Groups "QATrack+" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qatrack+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qatrack/21300783-d8ca-483f-b25c-a42b21c89edan%40googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages