Compare to previous result

1,350 views
Skip to first unread message

matt....@gmail.com

unread,
Mar 20, 2015, 12:59:49 PM3/20/15
to qat...@googlegroups.com
Hi,

I was wondering if it is possible to compare a current result to a previous test.

For example, we like to compare an output to the previous days and report if >1% change.

So I was wondering if this was possible?

Thanks,

Matt

Randle Taylor

unread,
Mar 20, 2015, 4:17:02 PM3/20/15
to qat...@googlegroups.com, matt....@gmail.com
Hi Matt,

Technically yes this is possible but only by directly accessing the database in a composite test.  What you would need to do is something like:

from qatrack.qa.models import TestInstance

try:
    previous
= TestInstance.objects.filter(
        unit_test_info__test__slug
="dose",
        unit_test_info__unit__number
=META["unit_number"],
        test_list_instance__test_list__name
=META['test_list_name'],
   
).latest("work_completed")
except TestInstance.DoesNotExist:
    previous
= None
   
deviation
= 100.*(previous.value - dose)/dose if previous else 100

That said, this is what I would consider a 'non supported' method and I can't guarantee it won't break in the future if something about the TestInstance model changes in the application.

matt....@gmail.com

unread,
Apr 2, 2015, 5:58:38 AM4/2/15
to qat...@googlegroups.com, matt....@gmail.com
Thanks!

I've managed to get that working as required.

Cheers,

Matt

MatthewSCA

unread,
Jul 17, 2015, 5:49:21 PM7/17/15
to qat...@googlegroups.com, matt....@gmail.com
Hi Randle,

I am having trouble obtaining the previous value. The value I would like to obtain is stored on the HDR unit (unit 6) with the "baseline_kair" macro name in the "microSelectron Calibration" test list. I'm assuming that there must be more to it than just these few lines of code:

from qatrack.qa.models import TestInstance

try:
    previous = TestInstance.objects.filter(
        unit_test_info__test__slug="microselectron-calibration",
        unit_test_info__unit__number=META['unit_number'],
        test_list_instance__test_list__name=META['test_list_name'],
    ).latest("work_completed")
except TestInstance.DoesNotExist:
    previous = None
 
result = previous.value

What am I missing to make this work?

Thanks.
Matthew

Randle Taylor

unread,
Jul 17, 2015, 9:36:03 PM7/17/15
to MatthewSCA, qat...@googlegroups.com, Matt B
Hi Matthew,

You need to use the macro name instead of the test list name to do the lookup (e.g. unit_test_info__test__slug="baseline_kair"). Also it's  important that you check whether previous_value is None or not either the way I did in the original response or more verbosely like:

   if previous is None:
       result = 1 # or some other default value
   else:
       result = previous.value

Hope that helps,
Randy


On 17 July 2015 at 17:49, MatthewSCA <matt.s...@gmail.com> wrote:
Hi Randle,

I am having trouble obtaining the previous value. The value I would like to obtain is stored on the HDR unit (unit 6) with the "baseline_kair" macro name in the "microSelectron Calibration" test list. I'm assuming that there must be more to it then just these few lines of code:

from qatrack.qa.models import TestInstance

try:
    previous = TestInstance.objects.filter(
        unit_test_info__test__slug="microselectron-calibration",
        unit_test_info__unit__number=META['unit_number'],
        test_list_instance__test_list__name=META['test_list_name'],
    ).latest("work_completed")
except TestInstance.DoesNotExist:
    previous = None
 
result = previous.value

What am I missing to make this work?

Thanks.
Matthew

--
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 post to this group, send email to qat...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

MatthewSCA

unread,
Jul 20, 2015, 11:32:48 AM7/20/15
to qat...@googlegroups.com, matt.s...@gmail.com, matt....@gmail.com
Hi Randle,

I got it working, thanks! I ended up assigning the specific test list name and unit number to their respective variables instead of using the META["..."] variables.

Matthew

MatthewSCA

unread,
Jul 20, 2015, 1:30:27 PM7/20/15
to qat...@googlegroups.com, matt.s...@gmail.com
Would I still use previous.value even if "previous" retrieved a string result? I cannot seem to figure out how to generate the previous result if it is not a number.

Matthew

Randle Taylor

unread,
Jul 20, 2015, 9:55:04 PM7/20/15
to MatthewSCA, qat...@googlegroups.com
Hi Matthew,

No, strings are stored in a field called `string_value` so you would need to use `previous.string_value` instead.  

RT

On 20 July 2015 at 13:30, MatthewSCA <matt.s...@gmail.com> wrote:
Would I still use previous.value even if "previous" retrieved a string result?

Matthew

MatthewSCA

unread,
Jul 21, 2015, 10:07:18 AM7/21/15
to qat...@googlegroups.com, matt.s...@gmail.com
Excellent. Thank-you so much!

Matthew

matt....@gmail.com

unread,
Jul 29, 2015, 4:29:24 AM7/29/15
to QATrack+, matt.s...@gmail.com
On Tuesday, 21 July 2015 15:07:18 UTC+1, MatthewSCA wrote:
> Excellent. Thank-you so much!
>
>
> Matthew

Hi,

Is it possible to look at say the previous 5 (n) values of a test.
For example, for tracking trends (other than looking at the graphs) it may be useful to do some calculations with the previous few results.
Is there a generic way to get the previous nth value of a test?

Possible uses include giving a weekly average/range of results.

Thanks,

Matt

Randle Taylor

unread,
Jul 29, 2015, 10:17:13 AM7/29/15
to Matt B, QATrack+, Matthew Strugari
Matt,

Sure you can get whatever data you want...the query for the last five values would just look something like:

previous5 = TestInstance.objects.filter(
    unit_test_info__test__slug
="dose",

    unit_test_info__unit__number
=META["unit_number"],
    test_list_instance__test_list__name
=META['test_list_name'],
).order_by("-work_completed")[:5]
prev_5_vals = [x.value for x in previous5]

alternatively you should be able to  do this:

prev_5_vals = TestInstance.objects.filter(
    unit_test_info__test__slug
="dose",

    unit_test_info__unit__number
=META["unit_number"],
    test_list_instance__test_list__name
=META['test_list_name'],
).order_by("-work_completed").values_list("value", flat=True)[:5]

The Django documentation is the best place to look for info on querying the database: https://docs.djangoproject.com/en/1.4/topics/db/queries/#retrieving-objects  

Reading test data is fine but I would *strongly* advise you not to perform writes (save/update) to the database in your composite calculations though.

RT

--
You received this message because you are subscribed to the Google Groups "QATrack+" group.

matt....@gmail.com

unread,
Jul 29, 2015, 10:29:17 AM7/29/15
to QATrack+, matt.s...@gmail.com, randle...@gmail.com
Thanks,

I'll give it a go at somepoint and see how it works.
Currently the use I see is for calculating a 'weekly' average from the last 5 results and storing this calculated value within its own composite test.
I can't see any reason i'd want to update the database mid test!

Thanks,

Matt

MatthewSCA

unread,
Aug 6, 2015, 1:50:04 PM8/6/15
to QATrack+, matt.s...@gmail.com, randle...@gmail.com, matt....@gmail.com
Hi Randle,

I have a submitted test list containing a multiple choice test with the options: 6 MeV, 9 MeV, 12 MeV, 16 MeV, and 20 MeV (macro name is "nominal_energy"). I also have another test which calculates the dose to water (macro name "dose_to_water").

How can I obtain the date and time from the most recently submitted test list only when 20 MeV was selected? Furthermore, how can I obtain the dose to water when 20 MeV was selected? I am having trouble filtering these results.

Thanks.
Matthew

Randle Taylor

unread,
Aug 7, 2015, 3:28:50 PM8/7/15
to MatthewSCA, QATrack+
Hi Matthew,

Hmm that's a bit trickier you would need to do something like:


from qatrack.qa.models import TestInstance

# first find last test list instance where 20MeV was performed
try:
    last_20mev
= TestInstance.objects.filter(
        unit_test_info__test__slug
="nominal_energy",
        value = 4 # 4 for 20MeV 0,1,2,3 for 6, 9, 12, 16 MeV respectively
        unit_test_info__unit__number=META["unit_number"],
        test_list_instance__test_list__name
=META['test_list_name'],

   
).latest("work_completed")
  
    last_20mev_tli = last_20mev.test_list_instance

except TestInstance.DoesNotExist:
    last_20mev_tli
= None

# if test list instance exists
if last_20mev_tli:

    # you can get a python DateTime object like this:
    datetime_completed = last_20mev.work_completed

    # and to get dose to water
    last_20mev = last_20mev.testinstance_set.get(
        unit_test_info__test__slug
="dose_to_water"
    ).value
   


Haven't tested that, but should be quite close.

RT

MatthewSCA

unread,
Aug 7, 2015, 6:37:43 PM8/7/15
to QATrack+, matt.s...@gmail.com
Thank-you Randle, I was able to get everything working! To get the dose to water I had to add "_tli":

    last_20mev = last_20mev_tli.testinstance_set.get(
        unit_test_info__test__slug
="dose_to_water"
    ).value

I also added "_tli" to the datetime section although it worked with or without "_tli":

    datetime_completed = last_20mev_tli.work_completed

Do you see any immediate problem with this?

Matthew

Randle Taylor

unread,
Aug 7, 2015, 6:49:03 PM8/7/15
to MatthewSCA, QATrack+

Good catch!  That was just a typo on my part.  RT

--

Matt B

unread,
Dec 1, 2015, 12:15:21 PM12/1/15
to QATrack+
Hi,

I have been doing something very similar as described below.
I am looking up a previous machine output value based on the dosemeter selected.

As far as I can see I have to know the position of an item in a multiple choice test to then use this in the lookup.
i.e. user selects dosemeter "B" from the multiple choice, but in the code this may have the value '1' if its second in the list.

Is there a way to get the position of the value in the list automatically rather than having to include (for example) a dictionary with the multiple choice values and their corresponding 'value' for use in filtering.

If it can be achieved automatically, then it would save having to edit many individual tests if an additional chamber was added into the multiple choice for example.

This may relate to Issue 162.

Thansk,

Matt

Randle Taylor

unread,
Dec 3, 2015, 9:41:13 AM12/3/15
to QATrack+
Hi Matt,

Here's what you can do:

from qatrack.qa.models import TestInstance, Test

test
= Test.objects.get(name="Ion Chamber")
choices
= test.choices.split(",")
chosen_idx
= choices.index(dosemeter)

try:
    test_instance
= TestInstance.objects.filter(
        unit_test_info__test__slug
="dosemeter",
        value
= chosen_idx,

        unit_test_info__unit__number
=META["unit_number"],
        test_list_instance__test_list__name
=META['test_list_name'],
   
).latest("work_completed")

 
    last_tli
= test_instance.test_list_instance

except TestInstance.DoesNotExist:
    last_tli
= None

if last_tli:
    last_output
= last_tli.testinstance_set.get(
        unit_test_info__test__slug
="dose"
   
).value
else:
    last_output
= -1


Which I've demonstrated here:

http://randlet.com/qatrack/qa/utc/perform/9/
http://randlet.com/qatrack/admin/qa/test/65/

You're right, it's related to that issue so when you upgrade next time you will need to modify your procedure slightly (it gets a bit simpler):

from qatrack.qa.models import TestInstance

try:

    test_instance
= TestInstance.objects.filter(
        unit_test_info__test__slug
="dosemeter",
        string_value
= dosemeter,

        unit_test_info__unit__number
=META["unit_number"],
        test_list_instance__test_list__name
=META['test_list_name'],
   
).latest("work_completed")

 
    last_tli
= test_instance.test_list_instance

except TestInstance.DoesNotExist:
    last_tli
= None

if last_tli:
    last_output
= last_tli.testinstance_set.get(
        unit_test_info__test__slug
="dose"
   
).value
else:
    last_output
= -1

Hope that helps,
Randy

Thomas Burrows

unread,
Jan 28, 2016, 11:08:26 AM1/28/16
to QATrack+
I was wondering could someone help. I am doing something very basic wrong I should think.

For simplicity say I have a test list for calculating the temperature and pressure correction (test list name - temp_press_corr). The correction itself has slug "f_tp".

When performing my outputs I want to access this temperature and pressure correction. I want it from the unit I am working on. I have been trying this:


from qatrack.qa.models import TestInstance

try:
    tpcorr = TestInstance.objects.filter(
        unit_test_info__test__slug="f_tp",
        unit_test_info__unit__number=META["unit_number"],
        test_list_instance__test_list__name="temp_press_corr",

    ).latest("work_completed")
   
except TestInstance.DoesNotExist:
    tpcorr = None
  
if tpcorr is None:
    result = 0 # default value
else:
    result = tpcorr.value


I keep getting a zero implying the test instance does not exist. I am sure its something basic but cant see where I am going wrong.

Any help would be greatly appreciated,

Thanks,

Tom

Randle Taylor

unread,
Jan 28, 2016, 11:23:43 AM1/28/16
to Thomas Burrows, QATrack+
Hi Thomas,

There's nothing obviously wrong about your procedure that I can see (assuming you have actually completed your temp_press_cor test list at least once before) .   Is the temp_press_corr test list performed on the same unit as the output test list? 

Really there's only a couple possibilities that the test instance would not be found:

1) The temp_press_corr test list has never been performed on this unit (the unit_test_info__unit__number=META["unit_number"] would filter the results out)
2) the "f_tp" slug name in your fitler isn't correct
3) the temp_press_corr test list name in your filter is incorrect.

Unless I'm missing something, I think it has to be one of those three things.

RT


--

Tom B

unread,
Jan 29, 2016, 5:01:26 AM1/29/16
to QATrack+, thomasp...@gmail.com
Figured it out,

I was using the slug for the test list and not the name - working now.

Thanks

Matt B

unread,
Jan 29, 2016, 7:52:53 AM1/29/16
to QATrack+
Hi Randle,

I have just come across a slightly interesting problem.

We have been happily comparing current results to previous using the methods suggested above.

It was pointed out to me today that if going back in and editing a previous result (say from 2 days ago), it is then comparing to the most recent result stored, and not the result form the previous session.

So I think what I would really like to be able to do is lookup the result that has an earlier date stamp than the current test, rather than looking up the latest stored result.
I assume I will need to apply additional filtering to exclude results more recent than the test being performed/edited? Not being too good with django, I wondered if you might know the best way to go about this?

Thanks,

Matt

Randle Taylor

unread,
Feb 9, 2016, 10:06:03 PM2/9/16
to Matt B, QATrack+
Hi Matt,

There is a `created` field on TestListInstace that you could use that to order_by instead of `work_completed` e.g. TestListInstance.objects.filter(...).order_by('-created') but you will probably also want to exclude in_progress test lists as well: TestListInstance.objects.filter(...., in_progress=False).order_by('-created')

Hope that helps!

Randy

p.s. Sorry for the very slow response on this. Had a crazy couple weeks and it got pushed down my todo list.

Randle Taylor

unread,
Feb 9, 2016, 10:15:53 PM2/9/16
to Matt B, QATrack+
Hi Matt,

There is a `created` field on TestListInstace that you could use that to order_by instead of `work_completed` e.g. TestListInstance.objects.filter(...).order_by('-created') but you will probably also want to exclude in_progress test lists as well: TestListInstance.objects.filter(...., in_progress=False).order_by('-created')

Hope that helps!

Randy

p.s. Sorry for the very slow response on this. Had a crazy couple weeks and it got pushed down my todo list.
On 29 January 2016 at 07:52, Matt B <matt....@gmail.com> wrote:

Matt B

unread,
Feb 10, 2016, 4:29:22 AM2/10/16
to QATrack+, matt....@gmail.com
Hi,

Thanks for the response, just to confirm, the 'created' field is separate from the 'work_started' accessible through the META variable?
So for example if for a daily test I was to go in and edit one from a 7 days ago, to look up the value of the test from 8 days ago would be along the lines of:

filter(.... before META[work_started]).order by(-created).

Thanks,

Matt

Randle Taylor

unread,
Feb 10, 2016, 11:49:05 AM2/10/16
to Matt B, QATrack+
Matt.

To answer your question, yes, it's separate from work_started.  Thinking about it more, ordering by work_started may work better instead ( filter(..., work_started__lt=META['work_started']).order_by('-work_started') ). That would avoid any issues if for example someone entered a bunch of historical data on a single day. 

However, I'm not sure why I didn't pick up on this last night, but the work_completed field should not be changing when you edit a previous test list. Which means that this problem shouldn't be occurring...can you confirm that when you edit a previous test list that work_completed is updated?  The only way this should happen is if the test list instance was originally marked in progress (and hence work_completed would not be set).

RT

Matt B

unread,
Feb 10, 2016, 12:18:33 PM2/10/16
to QATrack+, matt....@gmail.com
Hi,

I think possibly my original question wasn't very clear.

From what I can see the work_completed field is not changing, this remains as it was. (The modified/edited are changing as this the results are being edited by the user through adding of a comment during our review process).

I'll try and explain my original problem better:

On the test list, one of the tests looks up the value of the previous result to perform a comparison to this (using the methods outlines previously in this thread).
This works fine on a day to day basis as simply looking up the most recently performed tests result is the one of interest.
If however a user goes back to edit (or add a comment) form a few days ago, then this test now pulls the most recent result which won't be the one immediately before the test being edited.
I think I just need to work out how to filter to lookup form only results before the work_started date. That way the result being looked up will always be before the test being performed/edited.

An example of what I think is happening in my situation:
5 days tests are performed in order: Mon, Tue, Wed, Thur, Fri
The lookup of the previous value works when initially performing these (e.g. when performing Thur, the value form Wed is looked up correctly).

If however on Fri (after all 5 tests have been performed) the user goes back to edit the Wed test, the value looked up as the 'previous' result would be Fridays result, whereas it should still lookup the Tue result.

So I assume I need to go and have a look through the Django docs to work out how to filter to only return results prior to the work_started of the test list being performed/edited? That way, if editing the Wed test, only tests before this date would be returned with the filter.

Thanks,

Matt

metaf...@gmail.com

unread,
Feb 24, 2016, 11:10:11 AM2/24/16
to QATrack+, matt....@gmail.com
Hi,

We are just trying QATrack+ to see if it will be usefull for our center.

Sorry if it has been asked (or explained elsewhere) but i can't find it.

Where can i find some information about using data from previous measurements?
I read carefully the snippet explained at the begining of this thread and i cant make it work.

Thanks a lot in advance.

Randle Taylor

unread,
Feb 24, 2016, 11:28:23 AM2/24/16
to QATrack+
Hello,

There's currently no official documentation on accessing previous measurements (I didn't originally envision people accessing results in this manner).  Can you post the snippet you are currently using and I can see if I can spot anything that is incorrect?

Randy

metaf...@gmail.com

unread,
Feb 26, 2016, 10:20:32 AM2/26/16
to QATrack+
Hi,

As I said before we are just checking if QATrack+ can be useful to the way we work. We would be interested in checking previous data for several reasons:

When we are measuring dose we have to repeat pressure and temperature and maybe it could be possible to just check the previously measured value.

For DQA we measure the 10x10 field as a reference and i would like to use that reference for several patient measurements.

The code i'm trying to use is the snippet:

from qatrack.qa.models import TestInstance

try:
previous = TestInstance.objects.filter(
unit_test_info__test__slug="dose", #this is the test slug
unit_test_info__unit__number=META["unit_number"],#this is the unit number.
test_list_instance__test_list__name=META['test_list_name'],#test list name.
).latest("work_completed")
except TestInstance.DoesNotExist:
previous = None

but it does not work. I guess i'm not using the correct unit number or test list name.

I dont know what the meta means either.

Also it would be nice to pick data that matches certain criteria. like search by date.

Thx a lot for your attention.

Randle Taylor

unread,
Feb 26, 2016, 10:31:39 AM2/26/16
to QATrack+, metaf...@gmail.com
Hello,

Yes, lots of people want to compare to previous results, so hopefully we can make it easier in the future. 

If that is the entire snippet, you are missing a crucial bit at the end to set the result to the actual value. Here's an example of how you could do that.

from qatrack.qa.models import TestInstance

try:
    previous
= TestInstance.objects.filter(
        unit_test_info__test__slug
="dose", #this is the test slug
        unit_test_info__unit__number
=META["unit_number"],#this is the unit number.
        test_list_instance__test_list__name
=META['test_list_name'],#test list name.
   
).latest("work_completed")
except TestInstance.DoesNotExist:
    previous
= None


default_value
= 0 # can change to whatever value you want in

if previous is not None:
    result
= previous.value
else:
    result
= default_value


Randy

metaf...@gmail.com

unread,
Mar 9, 2016, 9:59:47 AM3/9/16
to QATrack+, metaf...@gmail.com
Thanks for your answer, it worked!!
(sorry for not having answered before, but i was waiting until i could try it out and different things kept getting in the way).

liam connolly

unread,
May 20, 2016, 8:53:29 AM5/20/16
to QATrack+, metaf...@gmail.com
What would be the best way to grab all the previous values of a test? I'm wanting to take the mean of the values then check to see if a newly measured value is within 1SD.

Randle Taylor

unread,
May 20, 2016, 9:08:44 AM5/20/16
to QATrack+, metaf...@gmail.com
Hi Liam,

It's similar to grab all the values for a given test.

from qatrack.qa.models import TestInstance

values = TestInstance.objects.filter(

    unit_test_info__test__slug
="dose", #this is the test slug
    unit_test_info__unit__number
=META["unit_number"],#this is the unit number.
    test_list_instance__test_list_
_name
=META['test_list_name'],#test list name.
).values_list("value", flat=True)


if len(values) > 0:
    mean
=  sum(values)/len(values)
else:
    mean
= -1 # or something else

# now do your other calculations/comparison

Hope that helps.

Randy

Matt B

unread,
Jun 28, 2016, 8:16:59 AM6/28/16
to QATrack+, metaf...@gmail.com
Hello,

We do a fair bit of comparing to previous results, and have it all mostly working how we would like.

I was wondering how I might go about getting a previous result and ignoring and 'N/A' values (i.e. where the test was skipped or didn't exist).

The code i'd like to adapt is:

from qatrack.qa.models import TestInstance, Test



test
= Test.objects.get(name="Dosemeter")

choices
= test.choices.split(",")

chamber_idx
= choices.index(dosemeter)

unit_test_slug
= "op_dif_6mv"

## gets the test instance containing the last dosemeter
try:
    previous_chamber
= TestInstance.objects.filter(
        unit_test_info__test__slug
="dosemeter",
        value
= chamber_idx,
        unit_test_info__unit__number
=META["unit_number"],
        test_list_instance__test_list__name
="Outputs",
        work_started__lt
=META['work_started'],
   
).latest("work_completed")
    last_chamber_tli
= previous_chamber.test_list_instance
except TestInstance.DoesNotExist:
    last_chamber_tli
= None

if last_chamber_tli:

    last_chamber
= last_chamber_tli.testinstance_set.get(
        unit_test_info__test__slug
=unit_test_slug
       
).value

result
=(last_chamber/100)+1

This looks up a previous output value based on the chamber selected in a dropdown.

Many thanks,

Matt

Randle Taylor

unread,
Jun 28, 2016, 8:38:04 AM6/28/16
to QATrack+, metaf...@gmail.com
You should just be able use exclude or filter to only include non skipped results.

from qatrack.qa.models import TestInstance, Test


test
= Test.objects.get(name="Dosemeter")
choices
= test.choices.split(",")
chamber_idx
= choices.index(dosemeter)

unit_test_slug
= "op_dif_6mv"

## gets the test instance containing the last dosemeter
try:
    previous_chamber
= TestInstance.objects.filter(
        unit_test_info__test__slug
="dosemeter",
        value
= chamber_idx,
        unit_test_info__unit__number
=META["unit_number"],
        test_list_instance__test_list__name
="Outputs",
        work_started__lt
=META['work_started'],

   
).exclude(skipped=True).latest("work_completed")

Matt B

unread,
Jun 28, 2016, 9:01:53 AM6/28/16
to QATrack+, metaf...@gmail.com
Hi,

Thanks for the quick response.

What I forgot to mention was that the value i'm trying to get is most likely not skipped.
Instead it is a composite value and so would not have been skipped, but just not calculated, hence not returning a value when looked up.
How would I exclude this case? I assume I cant just stick in
.exclude(value='N/A')

?

Thanks,

Matt

Randle Taylor

unread,
Jun 28, 2016, 9:05:00 AM6/28/16
to QATrack+

OK I see.  Using `.exclude(value=None)` will cover both those cases.

RT

Matt B

unread,
Jun 28, 2016, 9:18:57 AM6/28/16
to QATrack+
Hi,

Still not working here...

Getting value works as:
1. lookup the test instance which contains the data when the selected chamber was last used. ('value' within this is the chamber index, which will never be None)
2. lookup the value of the output from this test instance.

Do I need to somehow specify that the output value should not be 'None', rather than the chamber value during the test instance lookup?
Essentially something like: '.exclude(output.value=None)'?

Thanks,

Matt

Randle Taylor

unread,
Jun 29, 2016, 8:28:36 AM6/29/16
to QATrack+
You're right, sorry I didn't read that carefully enough.  I think here you have to use two different filter clauses (see https://docs.djangoproject.com/en/1.9/topics/db/queries/#spanning-multi-valued-relationships).


So you may be able to use a query like this:



from qatrack.qa.models import TestInstance, Test


test
= Test.objects.get(name="Dosemeter")
choices
= test.choices.split(",")
chamber_idx
= choices.index(dosemeter)

unit_test_slug
= "op_dif_6mv"


try:
    last_chamber_tli = TestListInstance.objects.filter(
        unittestcollection__unit__number=META["unit_number"],
        test_list__name="Outputs",
        work_started__lt
=META['work_started'
],
    ).filter(
        testinstance__unit_test_info__test__slug="dosemeter",
        value=chamber_idx,
    ).filter(

        testinstance__unit_test_info__test__slug="output",
        value__isnull=False,
    ).latest("work_completed")

except TestListInstance.DoesNotExist:

    last_chamber_tli
= None

if last_chamber_tli:

    last_chamber
= last_chamber_tli.testinstance_set.get(
        unit_test_info__test__slug
=unit_test_slug
   
).value

result
=(last_chamber/100)+1

Can you give that a shot?

Matt B

unread,
Jun 30, 2016, 7:26:59 AM6/30/16
to QATrack+
Not managed to get it working yet, but will keep at it. Haven't had time to work out where the code fails at the moment.

Matt

Philip Parsons

unread,
Jul 4, 2016, 10:24:05 AM7/4/16
to qat...@googlegroups.com
Hi Randle,

I have been trying to get a previous reading from a different testlist.  The testlist could have different energies in it and I want to get the last 6MV energy reading from it.

I've got the following, but it doesn't seem to be working.  Any ideas why not?  Thanks!

from django.utils import timezone
from qatrack.qa.models import TestInstance
from datetime import date
# get the latest average reading recorded for this linac on the same day.

try:
    last6MVinstance = TestInstance.objects.filter(
        unit_test_info__test__slug="energyModality",
        string_value="6MV"
        unit_test_info__unit__number=META["unit_number"],
        test_list_instance__test_list__slug="weeklyPhotonEnergy6mv",
    ).latest("work_completed")
    
    last6MV = last6MVinstance.test_list_instance
    
except TestInstance.DoesNotExist:
    last6MV = None
    
if last6MV is None:
    previousReadingAverage = 0
else:
    if exists.work_completed.date() <> date.today():
        previousReadingAverage = 0 # default value
    else:
        previousReadingAverage = last6MV.testinstance_set.get(
            unit_test_info__test__slug="ReadingAverage"
        ).value

Randle Taylor

unread,
Jul 4, 2016, 10:30:52 AM7/4/16
to Philip Parsons, QATrack+
Hi Philip,

You've got a couple issues that I can see here:


if exists.work_completed.date() <> date.today():
        previousReadingAverage = 0 # default value

1) `exists` isn't defined anywhere (I think you meant to use `last6MV` there) and 2) the inequality operator in Python is != instead of <>.

Hope that helps,
Randy



On 4 July 2016 at 10:24, Philip Parsons <plip...@gmail.com> wrote:
Hi Randle,

I have been trying to get a previous reading from a different testlist.  The testlist could have different energies in it and I want to get the last 6MV energy reading from it.

I've got the following, but it doesn't seem to be working.  Any ideas why not?

from django.utils import timezone
from qatrack.qa.models import TestInstance
from datetime import date
# get the latest average reading recorded for this linac on the same day.

try:
    last6MVinstance = TestInstance.objects.filter(
        unit_test_info__test__slug="energyModality",
        string_value="6MV"
        unit_test_info__unit__number=META["unit_number"],
        test_list_instance__test_list__slug="weeklyPhotonEnergy6mv",
    ).latest("work_completed")
    
    last6MV = last6MVinstance.test_list_instance
    
except TestInstance.DoesNotExist:
    last6MV = None
    
if last6MV is None:
    previousReadingAverage = 0
else:
    if exists.work_completed.date() <> date.today():
        previousReadingAverage = 0 # default value
    else:
        previousReadingAverage = last6MV.testinstance_set.get(
            unit_test_info__test__slug="ReadingAverage"
        ).value

--

Philip Parsons

unread,
Jul 4, 2016, 10:53:12 AM7/4/16
to QATrack+, plip...@gmail.com
Hi Randle,

thanks for that.  Unfortunately, it still isn't working.  Any other ideas?

Thanks,
Phil.

Philip Parsons

unread,
Jul 4, 2016, 10:56:50 AM7/4/16
to QATrack+, plip...@gmail.com
It looks like I missed a comma after         string_value="6MV",

but I'm now getting does not exist.  

Thanks again,
Phil.

Randle Taylor

unread,
Jul 4, 2016, 11:04:12 AM7/4/16
to Philip Parsons, QATrack+
Was just about to write the same thing.  Also I was wrong about the <> operator....I guess that is valid Python 2 but it's deprecated. I had no idea!

Is your energy modality test a multiple choice?  In that case you'll have to get the index of the 6MV choice rather than using the actual string value. Matt has done something similar in this thread:


test = Test.objects.get(name="Dosemeter")
choices
= test.choices.split(",")

chamber_idx
= choices.index(dosemeter)

In your case this would look something like:


from django.utils import timezone
from qatrack.qa.models import TestInstance
from datetime import date
# get the latest average reading recorded for this linac on the same day.


test = Test.objects.get(slug="energyModality")

choices
= test.choices.split(",")

energy_idx
= choices.index("6MV")

try:
    last6MVinstance = TestInstance.objects.filter(
        unit_test_info__test__slug="energyModality",
        value=energy_idx,
        unit_test_info__unit__number=META["unit_number"],
        test_list_instance__test_list__slug="weeklyPhotonEnergy6mv",
    ).latest("work_completed")
    
    last6MV = last6MVinstance.test_list_instance
    
except TestInstance.DoesNotExist:
    last6MV = None
    
if last6MV is None:
    previousReadingAverage = 0
else:
    if exists.work_completed.date() <> date.today():
        previousReadingAverage = 0 # default value
    else:
        previousReadingAverage = last6MV.testinstance_set.get(
            unit_test_info__test__slug="ReadingAverage"
        ).value


(Note in the next version of QATrack+ multiple choice values will be stored as strings rather than choice indexes)

RT




--

Philip Parsons

unread,
Jul 4, 2016, 11:07:53 AM7/4/16
to QATrack+
Unfortunately not, my energyModality is this:

# Allowed list of energies and modalities.
energyList = ["6MV", '10MV', '6MeV', '9MeV', '12MeV', '15MeV', '18MeV', '90kV', '170kV', '300kV']

titleName = META["test_list_name"]      # Get the title name.
titleName.replace(" ", "")              # Remove all whitespace.

for energy in energyList:
    if energy in titleName:
        energyModality = energy

And puts a string_value in the qa_testinstance table.

Randle Taylor

unread,
Jul 4, 2016, 2:15:19 PM7/4/16
to Philip Parsons, QATrack+

In that case are you sure it's hitting the DoesntExist exception and it's not the date comparison test that is failing?

RT

--

Philip Parsons

unread,
Jul 5, 2016, 5:51:30 AM7/5/16
to QATrack+, plip...@gmail.com
Yes, it put 1.0 in to for the DoesNotExist result and 2 for the date comparison and the test outputs 1.

Philip Parsons

unread,
Jul 5, 2016, 6:05:06 AM7/5/16
to QATrack+, plip...@gmail.com
Ok, apologies, I've been completely stupid!

I should have been looking up the slug 'weeklyoutput6mv' and not 'weeklyPhotonEnergy6mv'.

That's fixed it.

Thanks for your help!

Randle Taylor

unread,
Jul 5, 2016, 7:23:37 AM7/5/16
to Philip Parsons, QATrack+
Aha! Nice catch. Glad you got it sorted.



--

Matt B

unread,
Dec 9, 2016, 7:31:45 AM12/9/16
to QATrack+, plip...@gmail.com
Hi,

I was wondering if it was possible to look up the previous values, but rather than rely on the testlist name 
test_list_instance__test_list__name=META['test_list_name'],

is it possible to do this base don the slug?
We are potentially thinking of numbering our test lists, and so if the lookups didn't rely on the name, then we would be less likely to break things in the future...

Thanks,

Matt

Randle Taylor

unread,
Dec 9, 2016, 10:27:56 PM12/9/16
to Matt B, QATrack+, Philip Parsons
Unfortunately only the test list name is available in the META variable right now.  That said, if you're only using the test in one test list, you can still use a filter like:

test_list_instance__test_list__slug='some_slug_value',


Randy

To unsubscribe from this group and stop receiving emails from it, send an email to qatrack+unsubscribe@googlegroups.com.

liam connolly

unread,
Feb 22, 2017, 6:55:41 AM2/22/17
to QATrack+, matt....@gmail.com, plip...@gmail.com
Does anyone know of a way to get the time/date of a previous measurement?

I want to get some previous output results, so I'm using the code suggested in this thread:

from qatrack.qa.models import TestInstance




previous
= TestInstance.objects.filter(
    unit_test_info__test__slug
="op", #this is the test slug

    unit_test_info__unit__number
=META["unit_number"],#this is the unit number.

    test_list_instance__test_list__name
="Photon Output Check 6X",#test list name.
).latest("work_started")

Is there a way to grab the date that that particular result was recorded too?

Randle Taylor

unread,
Feb 22, 2017, 10:14:06 AM2/22/17
to QATrack+, matt....@gmail.com, plip...@gmail.com

`previous` will be a TestInstance object so to get a Python datetime object for when the test was started/completed you can do `date = previous.work_started` or `date = previous.work_completed`.

Randy

conno...@gmail.com

unread,
Jun 7, 2017, 12:37:25 PM6/7/17
to QATrack+, matt....@gmail.com, plip...@gmail.com
I seem to be having some difficulty, does unit_test_info__unit__number always have to use the META method? We've started recording ion chamber strontium checks using QATrack+ where each chamber is a different unit. I'd really like to be able to look up the result of a strontium check on a specific ion chamber while performing a linac output measurement. In this case, META['unit_number'] would return the linac's number (6) rather than the ion chamber's number (23).

I've tried unit_test_info__unit__number = 23, but it doesn't seem to be working. Any ideas?

Randle Taylor

unread,
Jun 9, 2017, 10:01:36 AM6/9/17
to conno...@gmail.com, QATrack+
Hi, 

No you don't need to use the META variable to look something up.  Hard coding an integer specifying a unit should work just as well.  Sounds like maybe there is some other problem with your calculation...if you post it here I can take a look at it and see if I can spot the issue.

Randy

On 7 June 2017 at 12:37, <conno...@gmail.com> wrote:
I seem to be having some difficulty, does unit_test_info__unit__number always have to use the META method? We've started recording ion chamber strontium checks using QATrack+ where each chamber is a different unit. I'd really like to be able to look up the result of a strontium check on a specific ion chamber while performing a linac output measurement. In this case, META['unit_number'] would return the linac's number (6) rather than the ion chamber's number (23).

I've tried unit_test_info__unit__number = 23, but it doesn't seem to be working. Any ideas?

Tom B

unread,
May 2, 2018, 10:42:47 AM5/2/18
to QATrack+
Hi Matt,

Did you ever get a work around for this? I would like to pull in some information from another test list but as you state I dont want it to rerun and pull in a more up to date result if someone goes in and adds a comment or edits.

Cheers,

Tom

On Wednesday, February 10, 2016 at 5:18:33 PM UTC, Matt B wrote:
Hi,

I think possibly my original question wasn't very clear.

From what I can see the work_completed field is not changing, this remains as it was. (The modified/edited are changing as this the results are being edited by the user through adding of a comment during our review process).

I'll try and explain my original problem better:

On the test list, one of the tests looks up the value of the previous result to perform a comparison to this (using the methods outlines previously in this thread).
This works fine on a day to day basis as simply looking up the most recently performed tests result is the one of interest.
If however a user goes back to edit (or add a comment) form a few days ago, then this test now pulls the most recent result which won't be the one immediately before the test being edited.
I think I just need to work out how to filter to lookup form only results before the work_started date. That way the result being looked up will always be before the test being performed/edited.

An example of what I think is happening in my situation:
5 days tests are performed in order: Mon, Tue, Wed, Thur, Fri
The lookup of the previous value works when initially performing these (e.g. when performing Thur, the value form Wed is looked up correctly).

If however on Fri (after all 5 tests have been performed) the user goes back to edit the Wed test, the value looked up as the 'previous' result would be Fridays result, whereas it should still lookup the Tue result.

So I assume I need to go and have a look through the Django docs to work out how to filter to only return results prior to the work_started of the test list being performed/edited? That way, if editing the Wed test, only tests before this date would be returned with the filter.

Thanks,

Matt



Matt B

unread,
May 2, 2018, 10:58:17 AM5/2/18
to qat...@googlegroups.com
Hi,

Yes I think we just include a line in the filter to only return results prior to the work_started date of the testlist.
something like the (direct copy and paste from one of our tests) below (which was based on a post somewhere in this thread?):

from qatrack.qa.models import TestInstance, Test

unit_test_slug = "gulmay_field_size_to_do"

## gets the test instance containing the last set of results
try:
    previous_result = TestInstance.objects.filter(
        unit_test_info__unit__number=META["unit_number"],
        test_list_instance__test_list__name=META['test_list_name'],
        work_started__lte=META['work_started']                         ##### note this line
    ).latest("work_completed")
    last_result_tli = previous_result.test_list_instance
except TestInstance.DoesNotExist:
    last_result_tli = None

if last_result_tli:
    ## get the value of the last result
    last_result = last_result_tli.testinstance_set.get(
        unit_test_info__test__slug=unit_test_slug
        ).string_value
else:
    last_result = 'None'

result = last_result

Hope that helps.

Matt

Philip Au

unread,
Nov 7, 2018, 2:09:40 PM11/7/18
to QATrack+
Hi Randle,

I am looking to find the number of days elapsed since the last test was performed and I used the following code.

I have checked that both META previous.work_completed objects should be the same type but when I perform the arithmetic it isn't working? Any pointers?

Sorry to revive an old thread.

Thanks in advance,
Philip  

from qatrack.qa.models import TestInstance
from datetime import timedelta

try:
    previous2 = TestInstance.objects.filter(
        unit_test_info__test__slug="foo", #this is the test slug
        unit_test_info__unit__number=META["unit_number"],#this is the unit number.
        test_list_instance__test_list__name=META['test_list_name'],#test list name.
    ).latest("work_completed")
except TestInstance.DoesNotExist:
    previous2 = None

default_value = 0 # can change to whatever value you want in 

if previous2 is not None:
    temp = META["work_started"] - previous.work_started
    foo = temp.days
else:
    foo = default_value 
Message has been deleted

Philip Au

unread,
Nov 8, 2018, 11:18:08 AM11/8/18
to QATrack+
Finally got everything working, probably have some redundant variables in there but it works. This test is for an MR unit where the center frequency is monitored on a monthly basis.


    date2 = META["work_started"] - previous.work_started #subtraction of 2 datetime objects.
    date2 = int(date2.days) #convert the datetime object to an integer, and using timedelta to extract "day" component only.
    res_pre = previous.value
    ctr_freq = (1.0e6*((res_pre - resonance_freq)/res_pre))/(date2)

conno...@gmail.com

unread,
Jan 8, 2019, 8:31:32 AM1/8/19
to QATrack+

Hello all!
This doesn't seem to work anymore for me in QATrack+ 0.3
Have the contents of TestInstance changed or has the usage of .filer() been modified in Python 3?

As a reminder I'm doing the following:

from qatrack.qa.models import TestInstance


try:
previous = TestInstance.objects.filter(
unit_test_info__test__slug='slug name',
unit_test_info__unit__number=unit number,
test_list_instance__test_list__name='testlist name',


).latest("work_completed")
except TestInstance.DoesNotExist:

previous = None


result = previous.value

Randle Taylor

unread,
Jan 8, 2019, 10:00:29 AM1/8/19
to QATrack+
That mostly looks fine to me and behaviour shouldn't have changed in v0.3.0 (assuming, of course `unit number` is replaced with an actual unit number!)  However, if no previous instance was found, your last line `result = previous.value` will fail (since None has no attribute.value).  Also, it is a good idea to filter the results to TestInstances occurring before work_started so if you ever go back and edit a test list instance, it will still grab the right value.

I would suggest a couple improvements:

try:
    previous
= TestInstance.objects.filter(
        unit_test_info__test__slug
='slug name',

        unit_test_info__unit__number=META['unit_number'],
        test_list_instance__test_list_
_name=META['testlist_name'],
        work_started__lt
=META['work_started']
   
).latest("work_completed")
    result
= previous.value
except TestInstance.DoesNotExist:
    result
= None



v0.3.0 also includes a new utility function that can simplify this!

previous = UTILS.previous_test_instance("slug name")
result
= previous.value if previous else None

Hope that helps,
Randy

Lauren Slater

unread,
Feb 1, 2019, 8:39:34 AM2/1/19
to QATrack+
Hi,

Would I need to add anything onto that new utility function if i'm calling a value from another test list, or should it find it from the slug name alone?

Thanks,
Lauren

Randle Taylor

unread,
Feb 1, 2019, 10:12:06 AM2/1/19
to Lauren Slater, QATrack+
That utility function will only find it from the same unit, but if the test was performed on the same unit, but a different test list then you can do:

previous = UTILS.previous_test_instance("slug_name", same_list_only=False)

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.

Lauren Slater

unread,
Feb 2, 2019, 5:20:09 AM2/2/19
to Randle Taylor, QATrack+

That works perfectly.  Thanks!

 

Lauren

 


From: Randle Taylor <randle...@gmail.com>
Sent: Friday, February 1, 2019 3:11:27 PM
To: Lauren Slater
Cc: QATrack+
Subject: Re: [QATrack+ 1263] Re: Compare to previous result
 

Matt B

unread,
Feb 8, 2019, 11:48:53 AM2/8/19
to QATrack+
Hi,

We lookup previous results a reasonable amount (currently not at v0.3).
Our beam output list contains all energies but occasionally not all energies are completed and so some results are skipped (and composite results not calculated).

So we would like to find the previous result which wasn't skipped and was wondering what the best method of doing this might be? Our current lookups look like those in this thread.

Methods for v0.2.9 and v0.3 would be handy for now and the future.

Many thanks,

Matt


On Tuesday, 8 January 2019 15:00:29 UTC, Randle Taylor wrote:

Randle Taylor

unread,
Feb 8, 2019, 11:59:40 AM2/8/19
to Matt B, QATrack+
Hi Matt,

For your TestInstance.objects.filter() queries you can just add a `skipped=False` clause to exclude TestInstances that were skipped (e.g. prev = TestInstance.objects.filter(foo='bar', baz='qux', skipped=False).  Does that make sense?

I will note that v0.3 UTILS.previous_test_instance function doesn't currently exclude skipped, but that was an oversight that I will remedy shortly.

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.

Matt B

unread,
Feb 18, 2019, 7:19:01 AM2/18/19
to QATrack+
Hi,

Yes the addition of "skipped=False" is just what was needed.

Cheers

Dave-o

unread,
Apr 4, 2019, 7:19:47 AM4/4/19
to QATrack+
Dear Randy,

We currently have a number of tests in which we make direct calls to the database to access test data from units different to the one on which the test is being performed. Some in our team are worried that future upgrades to QAT+ will render this method defunct. Would you say that directly accessing the database from a composite test is now a 'supported method'?

On the same line, is there any way to use - or any plans to enable use of - UTILS.previous_test_instance() to read data from a test performed on a different unit?

Best Wishes,
Dave
To unsubscribe from this group and stop receiving emails from it, send an email to qat...@googlegroups.com.

Randle Taylor

unread,
Apr 12, 2019, 10:16:12 AM4/12/19
to Dave-o, QATrack+
Hi Dave,

Yes, it is too useful a method to do away with in the future!  Sure, we could expand on the UTILS.previous_test_instance method to allow reading from different units.  If you don't mind, if you could file an issue for this on the issue tracker (https://bitbucket.org/tohccmedphys/qatrackplus/issues?status=new&status=open) outlining your use case that would be helpful.

Thanks,
Randy

To unsubscribe from this group and stop receiving emails from it, send an email to qatrack+u...@googlegroups.com.

Nejc Roškar

unread,
Feb 13, 2023, 7:41:59 AM2/13/23
to QATrack+
Hello,

I would like to retrieve the results from a previously completed test:

----------
try:
    previous = TestInstance.objects.filter(
        unit_test_info__test__slug="testX",
        unit_test_info__unit__number=META["unit_number"],
        test_list_instance__test_list__name="test_list_name",
        work_started__lt=META["work_started"],
    ).latest("work_started")


except TestInstance.DoesNotExist:
    previous = None
----------

...which works fine if testX is not a part of two cycled test lists, let say test_list_name1 and test_list_name2, which are exchanging every month for example.
I'd like to retrieve testX from the last completed test list in a cycle, so test_list_name1 or test_list_name2. How can I modify the code above?
Thank you in advance!

Best regards, Nejc



petek, 12. april 2019 ob 16:16:12 UTC+2 je oseba Randle Taylor napisala:

Randle Taylor

unread,
Feb 17, 2023, 11:26:59 AM2/17/23
to Nejc Roškar, QATrack+
Hi Nejc,

You can select from either test list by removing the "test_list__name" line from the filter and adding:

unit_test_collection__test_list_cycle__name="your test list cycle name"

to the filter.  If you don't mean from a test list cycle you can select one or more test list names like:

from django.db.models import Q
try:
    previous = TestInstance.objects.filter(
        Q(test_list__name="test_list_name_1") | Q(test_list__name="test_list_name_2"),
        unit_test_info__test__slug="testX",
        unit_test_info__unit__number=META["unit_number"],       
        work_started__lt=META["work_started"],
    ).latest("work_started")

except TestInstance.DoesNotExist:
    previous = None


Hope that helps!


Garry Grogan

unread,
Mar 4, 2025, 4:35:40 PMMar 4
to QATrack+
Hello All, 

I have been going round in circles trying to get a somewhat similar code to this chain to work. I have setup testlist which has reference expected values per arc for a particular patient specific qa for a month.

The actual measuremnet test will pull these values in based on month specified by a drop down list. This allow numbers to be entered in advance and not limited by instance/submission date. 

The code i currently have is below, this checks based on test submission date but i would want it to find the test instance when the setup test drop down and measurement test drop down both are the same month. Then from this test instance pull in a the reference value for particular TPS expected for arc. 

Unsure if as the drop down tests are the same in both cases i.e. setup and measurement if this preventing the code from running or i am not correctly querying month parameter as its a string value e.g March in test instance. 

Some advise or direction would be great. 

thanks, 
Garrry


from datetime import datetime
from qatrack.qa.models import TestListInstance, TestInstance

# Month name to number mapping
MONTHS = {
    "January": "01",
    "February": "02",
    "March": "03",
    "April": "04",
    "May": "05",
    "June": "06",
    "July": "07",
    "August": "08",
    "September": "09",
    "October": "10",
    "November": "11",
    "December": "12",
}


def get_equip(month_name, testlist):
    # Check if month_name is None or empty
    if not month_name:
        raise ValueError("Month name cannot be empty or None")

    # Get the current year if the year isn't provided
    current_year = datetime.now().year

    # Convert month name to month number
    month_number = MONTHS.get(month_name.capitalize(), None)

    if not month_number:
        raise ValueError("Enter Month.")  # Raise error if month is invalid

    # Format the string as "YYYY-MM"
    formatted_month = f"{current_year}-{month_number}"

    try:
        last_equip = (
            TestInstance.objects.filter(
                test_list_instance__test_list__name=testlist,
                unit_test_info__unit__number=META[
                    "unit_number"
                ],  # Ensure META is defined
                unit_test_info__test__slug="ac_arc1_ecl_dos",
                work_started__date__startswith=formatted_month,  # Filter by year and month
            )
            .latest("work_completed")  # Get the most recent test instance
            .value  # Get the value associated with that test instance
        )
    except TestInstance.DoesNotExist:
        # No matching TestInstance found
        last_equip = None

    return last_equip


# Ensure qa_month is set to a valid string, e.g., "February"
if qa_month == "":
    arc1_ecl_exp = "Enter Month"
else:
    try:
        arc1_ecl_exp = get_equip(qa_month, "PotM Std Setup - Halcyon")
        if not arc1_ecl_exp:
            arc1_ecl_exp = "No expected value found for this month"
    except ValueError:
        arc1_ecl_exp = "Enter Month"
    except Exception as e:
        # Catch any other unexpected errors and print them for debugging
        arc1_ecl_exp = f"Error occurred: {str(e)}"

tbe...@gmail.com

unread,
Mar 6, 2025, 2:43:16 AMMar 6
to QATrack+
Hi Garry,

maybe I am wrong but isn't what your are trying to achive in a single test list exactly what test list cycles are for? That way you would just create 12 test lists, one for each month and not have to program at all.

regards
Thomas

Garry Grogan

unread,
Mar 6, 2025, 2:50:23 AMMar 6
to QATrack+
Thanks Thomas,

The pre entered values may be used across multiple machines and predefined before you complete the current set on a particular machine.

I think we worked out the error in our code, calling a variable as an array rather than directly.

Thank you for your reply.

Garry
Reply all
Reply to author
Forward
0 new messages