Jump to content

Numeric Capsule Properties Being Treated as String When Converting to Signal


Go to solution Solved by John Patanian,

Recommended Posts

I have a condition configured where I am bringing in data from our LIMS system where the individual capsules represent results from lab tests and associated metadata.

There is one numeric field which is a pH measurement.  I am trying to use the toSignal function to extract the pH field and turn it into a signal. This works, except the signal is being treated as a string.

$signal = $lpmt.toSignal('pH', startKey())
$signal.toDiscrete()   

//Also have tried toNumber() .toLinear for example throws an error saying input needs to be numeric.

Is there any guidance about how to get this treated as a numeric value?

image.png

image.png

Link to comment
Share on other sites

  • Seeq Team

Your signal is being output as a string because the UOM for the pH capsule property is set to string. The best solution here would be to set the UOM on the capsule property to unitless (i.e. ""). Have you already tried setting the UOM for pH to be blank in the query definition? That would be the first thing I'd try, rather than having to fix it in formula.

Link to comment
Share on other sites

@John Brezovec

 

When I try to configure the capsule property to anything but string, then I get errors in the log files and I get no values for the PH reading.

For example here is an excerpt of my capsule configuration:

   "CapsuleProperties": [
                {
                    "Name": "Batch ID",
                    "Value": "${columnResult}",
                    "Column": "BATCH_ID",
                    "Uom": "string"
                },
                {
                    "Name": "Reference Procedure",
                    "Value": "${columnResult}",
                    "Column": "VARIANTID",
                    "Uom": "string"
                },
                {
                    "Name": "pH",
                    "Value": "${columnResult}",
                    "Column": "PH",
                    "Uom": ""
                },

And this results in no data getting pulled in for pH, with the following warning for each capsule found.
WARN

2024-08-21T18:31:26.037Z[JVM Agent: seeq-server-0: SQL: DSMFlex (DataLake): cec2017f-51bb-8d06-2e52-0b62b3e21398 [#3999] com.seeq.link.sdk.utilities.ParsedCapsule - Capsule property 'pH' with value '2.02' was removed because it has unit '' that is different from the expected unit 'string' from the Condition metadata

Link to comment
Share on other sites

Additional info. 

Using the API, I tried deleting the condition, and then reindexing the data source where the condition is defined.  Although I thought it would create a brand new guid, it seems to have re-used the condition that was in the trash (with the same guid).

I can see that even though in the configuration I set the pH capsule property UOM to "" (I also tried "Percent"), the response shows it has "unitOfMeasure": "string" for the pH property. 

image.png.cad2b906658754843b10dabc7d5ed180.png

Link to comment
Share on other sites

  • Solution

Update #2:

I deleted the condition using the API, changed the condition name in the connector definition, and then re-indexed. When I did that, it created a new condition with a new guid.  This time when I re-indexed and used the .toSignal function, it correctly treats the signal as a numeric value.

It looks like once I did my initial configuration and had the UoM property set to "string", it was impossible to update that property in place, even when re-indexing.

Only when I fully created a new condition (by forcibly changing the name), did the "unitOfMeasure" property get overwritten.

I believe this was a bug. To reproduce, set up a condition with a capsule property with unitOfMeasure = string and then try to change it in the configuration.

image.png.fe356a3bb6b5563be53e72ae01b924b1.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...