Using JMP Workflow Builder to Automate Analysis of an Annual Verification of a Spectrometric Method

Pharmaceutical products are tested for a range of attributes, including identification, assay, and uniformity of content. Whilst HPLC is commonly used for analysis, it can be time-consuming and labour-extensive. As a result, our company has registered an additional Raman Spectrometric method for several products.

As part of the license for these methods, an annual comparison with the reference method is required. For these comparisons, tablets or capsules are analysed by Raman before the same samples are analysed by HPLC. The comparisons between both tests are required to pass a range of acceptance criteria.

Analysis of the results has previously been completed by one staff member; with all procedures and results recorded in a notebook. A second staff member checks the analysis before generating formal report. Whilst automation of the calculations had been previously discussed, a lack of scripting experience hindered implementation.

The introduction of JMP Workflow Builder in JMP17 has enabled our company to automate the analysis without needing to learn to script, saving time and reducing potential errors. This presentation demonstrates the steps taken to generate a workflow, as well as presents the results via a dashboard.

 

Okay, so hello. My name is Zoë Betteridge, and today I'm going to be giving a presentation about using the JMP Workflow Builder. Our company, we've done this to automate analysis that we need to do on an annual basis.

Just a little bit of background. I work for a generic pharmaceutical company, and we make a range of tablets and capsules, about 150 different prescription medicines.

For those of you that aren't in pharmaceutical companies, what you may or may not know is that when we make a batch of tablets, we obviously need to test them before we can release them to market. We have to do a range of tests of checking that it is the drug that we're saying it is. It's got the correct amount of drug in the tablets, and there's no impurities that are going to cause a reaction in these tablets.

One of the main tests that we do is something called the Bulk assay, and this checks for the drug content. What we generally find is that it needs to be, for most of our drugs, it needs to be within 95-105% of what we're claiming it to be.

One of the traditional methods for doing this test is the HPLC, and this is a very well-established method that's used across multiple industries. It's a wet chemistry technique, so this means that you need trained analysts to be able to run it, and obviously, you need a lab with the equipment and the solvents and everything else.

A disadvantage of the method is that it has quite a long run time, or it can do. For a lot of our methods, the run times go overnight, and it takes a long time for us to get the results off. Another disadvantage is that in testing the samples, the method will destroy the sample. If we get a result that doesn't look quite right, we have to take another sample from the same batch to be able to retest. Obviously, it's a different sample at that point.

Now, our company has an attentive method that we've got on some of our licenses, and this is the Transmission Raman. Very basically, this is a laser-based technique where we shine a laser through our tablet or our capsule, and we get the Raman spectra at the end of it.

What the Raman spectra will have is peaks that correspond to our drug and peaks that correspond to the excipient. Now, by collecting a wider range of calibration spectra with different amounts of drugs and excipients, what we can do is create a model so that we can look at these peaks and their size and how they correspond to the other peaks and calculate the amount of drug in our capsules or tablets.

The advantage of this method is it's exceedingly easy to run. We basically put our tablets or our capsules in a tray, which is pictured there. That tray goes into the instrument. You basically select the method in the instrument, press a button, and then it runs. We get the results in seconds. Our quickest method that we have scans a tablet in five seconds, and I think the slowest one we have is a capsule scan that takes about 40 seconds per capsule.

Another great advantage of the method is it's non-destructive. If we get a result that doesn't look quite right, we still got the sample, so we can run an exact sample again and double-check our results.

The biggest disadvantage, however, is that it requires a multivariate modeling to get there. What you need is a wide range of calibration spectra to create your model in the first place. Obviously, you need somebody that's qualified and experienced in multivariate analysis to create the model and validate it.

As I mentioned, we've got this Raman on some of our product licenses. We've used Raman method for three different reasons. One is for the identification test, one is for this assay that I've described earlier, and one is to test for uniformity of content. This is a similar test to the assay, but it just looks like you get 10 or 30 tablets and just check that the drug content in them is similar between them all.

When we put this on our license, we've been asked by the regulatory authorities to do an annual verification. What we're required to do is once a year, compare our Raman method to our traditional method, which in all cases so far has been HPLC, but it could be titration or something else. We need to do this at least once over 12 months. This is just to check that these two methods haven't drifted apart from each other, and the Raman is still giving corresponding results.

Today I'm going to talk about one particular product and how we built the workflow for it. This is a product that's a capsule. We have it in three different strengths. We have 100 mixed strength, a 300 mixed strength, and a 400 mixed strength.

Then we have a set number of criteria that we need to fulfill each year. This is actually part of our license as well. What we do is we take 20 capsules for mixed strength, so 60 in total, and we take the spectra of each of these. The first criteria is the specificity. The spectra must pass our spectral ID check.

To do this, we look at the Q residuals and the Hotelling. The Q residuals looks at the spectra and checks that there's no peaks that shouldn't be there. The Hotelling basically looks at the spectra and checks that the peaks are all there in the proportionate amounts that we would expect.

Another criteria is looking at the linearity. We add the new spectra that we have from these 60 capsules to all the spectra that we collected previously. From the initial validation up to every single year's repeats that we've done. Basically we check that there's still a nice linear correlation between the HPLC results and our Raman results. Then finally, we look at accuracy. We just check that the difference between our Raman and our HPLC is between within the limits.

One additional thing that we need to do is that the Raman results that we create also must be within our license limit. There's no point in being able to pass the validation check they match, but actually have a tablet that's outside the limits that we can use to release it.

Traditional process has been this. Each year, when this validation comes round, we've had somebody in the lab who's gone and collected the spectra for the 60 capsules. Because it's a non-disruptive test, he's then gone on to collect the HPLC results for the same capsules.

That data has then been checked and approved, and it's been passed to me in the office. I've then done the analysis. I've concatenated tables together, done all the JMP subsetting, and tabularized what I need to, and checked against all the acceptance criteria.

Now, one of the things that our quality department has asked is that I make a note of every single step that I do in JMP. I have to write in a notebook where I've concatenated, how I've subsetted, what results I've got, et cetera. I then pass this lab work onto another analysis in our QC team, who then checks and repeats absolutely everything that I've done, checks that what I'm doing is sound and valid, and that they get the same results at the end. If they do, and they agree with me, we put all the results into a report and that gets approved by our quality team.

Now, as you can imagine, this is quite a slow process, and we're often being asked to get things done, so we can release drugs out of the manufacturing. It's quite repetitive each year. What we wanted to do is this updated process. We still have to collect the data, that can't change. But rather than doing the same steps over and over again manually, what I wanted was a way to get the data, press one button, and then generate all the results that I wanted. Because that would have been automated, we could have validated it all, so nobody else would need to double-check me, so we could put it straight into report and send it to the quality team for approval.

Now, the problem that we had is that whilst I can look at a script and I can work out generally what that script is doing, I've got no scripting knowledge to be able to write that script myself, and nor had anybody else in the company. This is where the Workflow Builder comes in.

In JMP 17, and JMP Pro 17, you've this Workflow Builder, and this has just been perfect for us. If you look, this has just come from the web page. But what the Workflow does, it automates workflow. It's actually what we need. Shares it, which I can also do. Reruns the sequence of steps with new data, so I can use it each and every year that I need to do so. And archives and documents an analysis. It's exactly what we wanted to do.

Let's go to the Workflow Builder. To get to the Workflow Builder, you very simply need to go to File, New, and then you've got this workflow at the bottom. Then in Windows, at least, you can press Control, Shift, and K to get there.

You get your workflow, you'll notice you've got these three panels. Your workflow steps will appear in this first panel. The Step settings are in here. This is the scripting, the name of each of the steps, and any comments that you might want to add. Then you've got your usual JMP log here at the bottom.

Now, you notice at the moment, all these steps are all grayed out. I don't have any steps in my workflow, but you do have this big red button here. This is our recording button, basically. When I press the button, you get this little cross appearing. And JMP will now start recording every step that I make in JMP. Let's do some steps.

First of all, let's open some files. First of all, I'm opening my base table. This is basically the table that I've got of all the spectra from all the previous validations that I've done. I've got 1,310 different spectra in here. If I then go back. Sorry. All right. Open my next file. This is my next dataset. What we find is every year when we do this verification, we just increment the number up. This year's one is the ninth report. Let's open this dataset up.

Then obviously, the first thing that we need to do is join the two together. If we just do a simple concatenation, add in this dataset to this one. I want to call it my base one. In fact, I want the formulas. What we have here. Then now I'm done with this REP09 Dataset, if I can find it. I can close this one down.

If I go back to my workflow, what you should see is it's starting to record now. If I click on each step separately, you'll see that we've got the script here for opening up the presentation, the script for opening up the ninth repeat of the dataset, the script here to concatenate the two tables together, and the fact that I closed down this REP09 without saving.

Let's keep going. Let's have a look at some of the analysis. As I said, one of the first things that we want to do is this spectrum check. By that, we just do a quick Fit Y by X, look at the Q residuals and the Hotelling.

I have here my plot. This is for all the data. I only really need to check the new spectra are okay, so I can add in a local data filter by the dataset, and just check the new ones are okay. Just to tidy up for our quality teams, let's just color code it by strength. We've got to see which is which. Let's add in some axis and some reference lines.

You see here, so this is our limit for our Q residuals. Everything's nicely underneath. If I do the same for the Hotelling, everything's right underneath this one. What we can conclude from this is all the spectra for this re-analysis, they will pass our spectrum check.

Our quality team don't just like figures. They like to have the raw numbers as well. For instance, we could do something else like tabulate the data and have a look at these max values for our Q residuals and Hotelling. We click to max and drop that in there. Do it by our batch. I'll just change our decimal basis slightly. I'll create this one. When I do that, and we've got our Q residuals. Again, if I want to put a local data filter in, just because I only need to see this year's.

Again, we've got the thing. Let's shut that one down. Shut this one here down and go back to my workflow. What you'll see now is we've also got the scripting for the Fit Y by X in here. This has got the various color coding and where I've put in… I should have done at least. The limits in there. Again, tabulating the data. There we go. Sorry, the limit's in this one. The tabulating data.

Going forward, we've now got steps in here. What you should see is that you've got… If you click on things, you've got these arrows on the side here. If we go for these ones, these arrows will move. If you select a step, it will move it up or down your workflow depending on where you want it. For instance, if I wanted to create my Fit Y by X before I tabulated the data, I could just move it up and down. Equally, if I didn't want it to step anymore, I can just bin it out.

You've also got this Execute button. This will execute my whole workflow, which we will do in a minute. A Reverse button, and then you can execute just certain steps to move forward and backwards.

If I just carry on, anyway, I'm just showing a couple of more things. If I say I want to do a summary table, and let's just get that, so I can see it. I want to take the mean results from my Raman and my… Just do it quick. I can create a secondary table. Let's just say I want to have a look at the difference between my Raman and my HPLC for each batch. I can call this Residuals. Just make it a few decimal places. Add a quick formula in. I just need to convert it into a percentage from strength.

What you should see, we've got this formula. Again, if we go back to the Workflow Builder, all these steps are in here adding in this data table summary. The steps that you can make, creations that you can do in JMP, and the fact that I've added in a new column, and I've added in a formula to this column, it's all scripted in here.

Now, as I said, you've got this Start/Stop button. Let's say you're building your workflow, you wanted to stop it, work on something else for a while, and then come back, which you may well do. But let's for instance say you've stopped it, but then you've picked it up to keep going, but you've forgotten to press record. It's not the end of the world, you still have a few options. If I go back to my summary table, I've just made that one. Let's just say I want to do a distribution plot of these residuals. Have a look at them.

I've got this, and I've got my table. What I can always do is I can save that script. You have in here an option to save your script to your workflow. If I was to press that and go back to my workflow, what you should see now is that script, even though I wasn't recording, I've managed to keep it and save it into there.

This is building up the script. I'm not going to do all of it. Obviously, it would take a while. What I'm going to do is just shuffle this down for now without saving any of it. I'll just show you the script that we end up with for my validation. Here we are. Here's the script. What you've got is all the various data manipulations and tables that I need to make and formulas, and then all the reports that are collected from it.

What you see is just a couple of things. This line here is grayed out. This is because I've disabled this particular step. This is just because for the purpose of this presentation, I didn't want to keep them overwriting the same table and saving it over and over again. I would normally have it enabled. But if I wanted to enable it again, I could just click on this, say step enable, and then it's enabled. I just want to disable it for now.

We've got all the steps in here. If I wanted to make a note, I can just say what it's doing in here. But let's run it. We press the Execute button. This should execute my workflow. You'll see it does all my manipulations and creates all my tabulated data, which is quite a lot of it.

Now, there are a couple of little issues that I've got. What you'll notice is, especially the first few steps, that we open our base table. That's absolutely fine. That's going to be called the same thing each year. But then we open this REP09 dataset, and that's fine for this year. But next year, we're going to be on REP10, and the year after, 11, 12, and so on.

What we want to do is basically be able to have a way where we can pick whichever file we want. We can do that. If we go back to my slide. There is a way of… I'm just doing a small script change, which will get us to being able to do this. What we want to do is replace the name of that file to this browse = pick File option, and I'll show you that on the next slide. But just to note that you've also got the option, if it's not a file that you want to pick, or it's an actual folder, you've also got this pick Directory option. If you've got a set of files in a folder and that name of the folder changes each year, you can select a different folder instead.

Let's have a look at this in a bit more detail. We have on the left-hand side here, this is how my script is currently looking. This is the small changes that we need to make. What you'll see is it's not a lot of changes. It's quite simple. The first steps that we've got going down here, we've got opening the JMP base table. We open at the moment this particular named table, and we concatenate these two together, and then we close down this named table without saving it.

The simple change is that we want to do this browse = pick File when we have this lining at the start. We then open our base table up. We then open this browse table instead. This basically is we're changing the line here to open browse, which means that we can select the table, and then all we're doing is calling whatever table it is that we've opened. We're just going to save it as the new validation.

This means that I can then do this next step. I can just concatenate the base table to new validation. At the very end, this last step of closing down new validation without saving.

Whilst on here, there's another key little point in JMP that's quite handy to know is that if your workflow is saved in the same location as the files that you're looking at, which is what's the case for my presentation today, you don't need this whole directory file length. You can just have the name of that table. Now, this is quite useful for not breaking links. I don't know if your companies are the same as mine, but we have people that have this habit every now and then of tidying up all our shared files and moving things around, and all my shortcuts disappear. By not having to name the whole file length or file path, it means that if that should happen again, my workflow will still work for me.

Going back to my Workflow Builder, I'm just going to reverse all this, so it's cleaned up and shut this one down. Then, if I now open In this next workflow, this is just where I've done these changes that I've said about. If we have a look in here, I've now got this. I'm opening this browse = pick File and then just saving it as New Validation. Now when I concatenating it, I'm concatenating New Validation, and then at the end, closing out New Validation.

Let's run this workflow. Fingers crossed, this time, it's asking here to choose a file. I can choose my REP099 dataset, and then it will proceed with the rest of the steps. We have our workflow, which is absolutely fantastic. Now, the only problem that I have with this, if you have a quick look at my window, what you'll see is I've got an awful lot of tabulated data formed, and it's quite a mess.

What I wanted is a way to be able to display this data and make it a bit cleaner. This is where Dashboards come in. Back to the slideshow. Dashboards, again, just taken from the JMP web page, is basically a way of being able to visualize all your reports.

Again, you don't need any scripting knowledge. There's a nice builder and template that I'll show you in a second. It's just you've got this Dashboard Builder. That's a very simple way of doing so. The first way, if I go back to my workflow, of creating a dashboard, is you can actually go to this window menu and go to Combine Windows.

This one will show you all your windows that are open. Let's just say this time I want to put some tabulated data in. I don't know, variability chart, and let's just say I've got one of my tables. If I press okay, it should hopefully upgrade it. Sorry. I've lost it. I might just have to do that again quickly because I just closed. I have just lost where I put it. There we go. Sorry. Because it's calling from two tables, it just wants me to assign them. They're all fine. Then what we see is this dashboard.

What we've got is my table in here, my variability plot in here, and this tabulated data. Again, this is all interactive. If I want to filter across or change things, I can do so. This is great. If you've only got two or three different reports you want to put in, but in my case, I've got a lot of different reports, so it's way too complex just to do combined windows. Let's close this down and build ourselves a dashboard.

If you go to File, New, and then you've got this option, Dashboard. What you will find is this Dashboard template. There's a few templates in here ready to go. You had four reports. You've got this two by two grid that you can use. If you have one report, but you want to be able to put a filter on it, you've got this template here. But in my case, I want to just have a blank template and build up my own custom dashboard.

Now we're on to the Dashboard Builder. What you will find is you've got all these reports down the side here. These all my tabulated data and my plots. At the bottom here, you've got some other options. You can put things like column switches and data filters in. If you want to add a data table with the options there or pictures or text boxes.

How do we go about doing so? Let's start building. The first thing I'm going to take my spectral ID check figure, and just drag and drop it into the dashboard. Now, for instance, if I want to check the linearity figure and put this in, I've got some options at this point.

If I can put it underneath, we'll add it to this vertical list, and it just stacks them on top of each other. I can add it into the slide here, and add it horizontally next to each other. Or the final option you've got is you can add it, insert it after tab. That's what I'm just going to do here. That just means I've now got one tab for my spectral check. Then, if I tab on to the next one, I can put in my linearity check.

Let's see how that looks. If you go to this red arrow, you've got some options here. You can even run your Dashboard at this point, but what's very handy to have is this preview mode. If I run the preview mode, what we have here is this first tab. Again, nice and interactive. Click on that. I can look at each dataset, and then I've got this checking the linearity between [inaudible 00:25:15] together. You see this nice linear relationship.

I close the Dashboard. Let's keep going. As I mentioned earlier, our quality team like to have the numbers as well as the figures. In this particular tab, I want to put two different things in. I can add a container in. This just allows me to put something else into this box. If I put the tabulated data in as well, again, it will give me the option to put it in horizontally. Again, if I go back to the preview mode, I'm going to hang it and just shift things along a little bit. Hopefully, you'll see that I've now got in here the tabulated data and my figure.

Now, what you should see, because I did it earlier, is I put in a filter for the figure and a separate filter in for my tabulated data. But this is a little bit cumbersome because actually I'm going to want the same filter settings on both of these at the same time. Can I tidy this up a bit? Well, the answer is yes. You can move these local data filters out. Let's just get rid of them. If I close this dashboard, this is where things like this data filter comes in. I can add this into my horizontal list, and I go back to the preview mode. You can see now. I can just do it quick tie up. Is that I've got both the tabulated and the figure, but without a filter on.

If I add a filter in here, what you should see is that it's going to filter both of them together at the same time, which makes it a lot easier to use. Just one thing to note, if you've got multiple tabs, and you're adding a filter in, it will apply to every single figure or graph that you have that comes from that table, even if it's on a different tab. If you leave it on one tab, and you go to a different figure, you will find that you are prefiltered. Sometimes it is better just to keep your local data filter attached to the particular tabulated data plot.

Again, you can do little things in here. In the preview mode even of changing bits. You can get the ID check and name things and various options in there. Now I just want to close this down. Then what I'm going to do is open the script that I've got that should have the whole workflow for my… Oh, sorry, the folder dashboard that I need. Here we go.

This is my finalized dashboard that I've created. We've got the spectral check, which has got the filter in. We're checking the linearity, and I can filter on here, looking at the residuals, looking at the accuracy and checking that the Raman is within specification.

One thing to note is when you're using the Workflow Builder, even if you've got the record button going, you will not record the creation of your dashboard in there. You have to add this manually in. That's not a problem. What you do is save your script of your dashboard. You go to Dashboard, Save Script into a Script Window, which I've already got here, so I won't do that again. In your Script Window, if you just copy all and then go to your dashboard, what you can do is under the red button, go to Add Custom Action, and then if you click on this one, you can just paste in your script, and then you can call it whatever you like in here.

If you want to try to comment. One thing just to note on that, though, is at the bottom, because this has come from the Dashboard Builder, it's in its Edit mode still. But obviously, what you want in your workflow is it to run. You just need to change the word Edit to Run at the bottom there.

We've now got our dashboard in there. It means that we don't need any of these reports anymore because they're all included in the dashboard. I'm just going to close this for the rest of this one up. Close this one down.

If I open my final presentation workflow, what you're seeing here is a little bit cleaner. We've got all the various steps that I need to do in JMP. Then finally this dashboard scripted in that button. If I just play this, it should hopefully ask me to open the file. I open this REP09 dataset. Go for the various steps. Then this time, it just does the tables, but rather than opening up every single figure, it just wants me to assign the tables properly.

I've got my… Just cannot go through that. My final report tidied up. Now, if I want to, go back to Spectral IDCheck, copy, I can still, and put it in a report, I've still got this Edit, Copy Graph, and I can still do that afterwards.

This is report four. Let's just reverse that. Run it again. Now I'm running it the next year. I'm on to the Report 10 dataset. It should do all the same steps again. It'll ask me to assign tables. What you can see here, from this thing, is I've got the REP09 in there from the previous run, but now it's added the REP10 in as well. I've got everything I need, and it's much, much simpler and a lot quicker.

Just finally to go back and do a quick conclusion. We've got the JMP Workflow Builder, which is a really simple way of being able to script all your steps that you're doing without actually needing to know the scripting language. You've got on here your control panel at the top here, which will start and stop recording, which is key. We'll execute this workflow or reset it, or, which I haven't changed today, we'll just do one step at a time or just rewind one step at a time.

You can change the order of things up and down, and you can discard any steps you don't want. If you right-click on any individual steps, you've got the options to enable, to save steps. Or, again, I didn't show this, you could just run a single step. In the process of building it, if you just want to check your one step works, you can just run that again.

In your Step Settings windows, you've got your name, which you can change to whatever you want, add any notes in, then all the script that you need is in there, and that's editable if you need to.

You then got the JMP Dashboards. On the Dashboard Builder, you've got all your reports and then the ability to add columns, data filters as well. If you want to put your data tables into the dashboard, you can do so. Things to note that I didn't say earlier is that it will be whichever table is listed in this box at the top, and you've got a drop-down menu to pick which one you want.

When you add things in, you can add them in horizontally, you can add them in vertically, or you can put them in after tabs and create tab boxes. Then under your red triangle here, you've got your Dashboard Mode that you're in to build it, a Preview Mode, which is really helpful. You can run your dashboard, and importantly, in terms of workflow, save your script to add it into your workflow. That's everything, and thank you very much.