Issue with join on patient name in Cerner SMART on FHIR tutorial in SmartHealthIt App Launcher - smart-on-fhir

Running the Cerner SMART on FHIR tutorial out of the box I get an unknown method Javascript error for the following lines.
fname = patient.name[0].given.join(' ');
lname = patient.name[0].family.join(' ');
I've currently resolved by changing to the following
fname = patient.name[0].given;
lname = patient.name[0].family;
What is the correct fix for this? I'm assuming the above is not a perfect work around.
Cerner tutorial is here: https://engineering.cerner.com/smart-on-fhir-tutorial/
SMART App Launcher is here: https://launch.smarthealthit.org/

Patient.name is datatype HumanName. The family property (i.e lastname) is not an array, so calling join on it is incorrect.

Related

Read variables value from PLC with Python opcua-asyncio – BadNoMatch: “The requested operation has no match to return.”

Edited to correct some typos:
Hi I’m new to opcua-asyncio package so please be patient if I missed something really obvious, I’m trying to figure out how to connect to a Siemens S7 1200 CPU 1212C firmware version 14 PLC from Python (3.11) and read some variables values.
I’m sorry I can’t figure out a way to support my case with a reproducible example because it’s intrinsically connected to the test PLC I’m working with, if you can suggest a way to make it reproducible I’m going to amend the answer accordingly.
The structure on my test PLC is detailed in the picture, I can access it through different clients, the variables from t1 to t19 are my goal.
[PLC Structure][1]
I went through the documentation (especially the client minimal example ) and some stackoverflow answers and I wrote the following code
# modules
import asyncio
from asyncua import Client
# url and namespace
url = foo bar # the plc location on the network
namespace = "OPC-UA:PLC_1"
t2 =[]
# I can find the objects inside the node
async with Client(url=url) as client:
# Find the namespace index
nsidx = await client.get_namespace_index("urn:OPC-UA:PLC_1")
print(nsidx)
root = client.nodes.root
print("Root node is: ", root)
objects = client.nodes.objects
print("Objects node is: ", objects)
# I can’t find my variables
var = await client.nodes.root.get_child(
["0:Objects", "3:ServerInterfaces", "0:Face"])
print("Var is: ", var)
t2 = await var.get_children_descriptions()
print(t2)
By my understanding of the structure in OPC-UA:PLC_1 namespace I should find an “Objects” node object listing a “ServerInterfaces” node object listing a “Face” node object listing the variables from t1 to t19. However if I ask “Objects” to describe its childs through get_children_descriptions() I can see the ServerInterfaces node object however this Serverinterfaces appears to be named “Face”.
If I ask for the childrens of “Face” I receive a BadNoMatch error.
Any help pointing me to the right direction would be much appreciated. Thank you!
[1]: https://i.stack.imgur.com/QyQCJ.png
I think the Browsename namespace index of Face is wrong.
The index 0 is used for the base nodeset.
You can check the correct index with an other UA Client like the UAExpert (here you need to look at the attibute window not the address space window (which do not show the namespace index)).
If you defined the Face in the face "OPC-UA:PLC_1" the line should be:
var = await client.nodes.root.get_child(
["0:Objects", "3:ServerInterfaces", "3:Face"])

Connection string Issue with SQLite

Need a little help with SQLite connection string. I’m using Mono.Data.Sqlite. I know If my database.sqlite resides in local computer then the format for connection string is “URI=file:" + "<Directory-Path>/database.sqlite" and it actually works for me.
But what will be the format of connection string for a network location. Assuming that I have my database on some server and given the following parameters:
Server = "swipe.example.com";
Username = "example#swipe.example.com";
Password = <Some Password>;
DatabasePath = "swipe.example.com/database.sqlite";
I have tried searching forums several times but found no solution at all. I will really appreciate If you could let me know.
Thanks
SQLite is serverless.
Visit this link for more information :
https://www.sqlite.org/serverless.html
You can use http://www.sqlitening.com/

Insert/Update SQL table from observablelist

Ok, so I'm working with an ObservableList, which is working fine, but now I need to use the observable list to insert rows into and update rows in an SQL database table. I've found little info on working between JavaFX and SQL databases ... all the examples of data tables have the data created in the java code. I had hope when I saw "update SQL database" in this post:
Update sql database from FoxPro data on Glassfish server
but it was not applicable to my situation.
So the question is, how do I start the code to read from the ObservableList so I can run my SQL Insert statement? If you could point me to an example code where an ObservableList is used and an SQL table is created/added to/updated I would greatly appreciate it.
Thanks!
UPDATE TO QUESTION:
I can't really post relevant code here because the relevant parts are what I don't have. However, I'm thinking what I need to do is something like this:
mylist.moveToFirst();
while (mylist.next()) {
make connection // think I got it
INSERT INTO mytable (name, address, phone) VALUES (observablename, observableaddress, observablephone // think I got this as well
Obviously I'm applying my knowledge of other areas to ObservableList, but I am doing it to demonstrate what I don't know how to do with my ObservableList (mylist).
Again, thanks for any help.
Tying up loose ends today, and this question has not really been answered. I reposted a newer question with more specifics once I learned more about the situation, and that question also went unanswered, but I did figure it out, and posted an answer here: Understanding my ObservableList.
However, to be neat and tidy, let me post here some code to help me remember, as well as help anyone else who looks at this question and says, "YES, BUT WHAT IS THE SOLUTION?!?!?"
Generically, it looks something like this:
I like to open my connection and prepare my statement(s) first.
Use the iterator to get the variables from the list
within the iterator, add the variables to the prepared statement and execute.
I read somewhere about batch execution of statements, but with as few updates as I'm doing with each list, that seemed too complicated, so I just do each update individually within the iterator.
Specifically, here is some code:
Connection con;
con = [your connection string]; // I actually keep my connection string in its own class
// and just call it (OpenDB.connect()). This way I can swap out the class OpenDB
// for whatever database I'm using (MySQL, MS Access, etc.) and I don't have to
// change a bunch of connection strings in other classes.
PreparedStatement pst;
String insertString = "INSERT INTO People (Name, Address, Phone) VALUES (?, ?, ?)";
pst = con.prepareStatement(insertString);
for(Person p : mylist) { // read as: for each Person [a data model defined in a class
// named Person] which in this set of statements we shall call 'p' within the list
// previously defined and named 'mylist' ... or "For each Person 'p' in 'mylist'"
String name = p.name.get(); // get the name which corresponds to the Person in this object of 'mylist'
String address = p.address.get(); // ditto, address
Integer phone = p.phone.get(); // ditto, phone. Did as integer here to show how to add to pst below
pst.setString(1, name); // replace question mark 1 with value of 'name'
pst.setString(2, address); // ditto, 2 and 'address'
pst.setInt(3, phone); // ditto, 3 and 'phone'
pst.executeUpdate();
And that's how I did it. Not sure if it's the 'proper' way to do it, but it works. Any input is welcomed, as I'm still learning.
In JavaFX you usually get to be the person to create the example :)
ObservableList supports listeners, these receive events which tell you what has been added or updated by default. There is a good example in the javadocs here.
To get update events you need to provide an 'extractor' to the method creating the list here. This should take an instance of the object in the list and provide an array of the properties you want to listen to.
Try this:
SQLEXEC(lnConn, "Update INVENTORY SET brand = ?_brand, model = ?_model, code =?_code, timestamp =?_datetime where recno=?_id ")

how do I make a python gql query with a hardcoded string?

I'd like to create a gql query through my browser dashboard to easily look up specific entries, i.e. something like:
SELECT * FROM MyEntity where mString = "SpecificEntity"
but I can't quite get the syntax right. I see a lot of examples using parameter binding/substitution (not sure what it is called), but I don't know how to simply just write it directly without getting an error when I try to query. Any help?
Update: This was for Python (and answered nicely already).
Some (python) examples from here:
query = GqlQuery("SELECT * FROM Song WHERE composer = 'Lennon, John'")
query = GqlQuery("SELECT __key__ FROM Song WHERE composer = :1", "Lennon, John")
query = GqlQuery("SELECT * FROM Song WHERE composer = :composer", composer="Lennon, John")
When in the App Engine dashboard, you have to use single quotes.
SELECT * FROM MyEntity where mString = "SpecificEntity"
Becomes
SELECT * FROM MyEntity where mString = 'SpecificEntity'
What sort of error do you get? These are easy to find in the application log (if you've uploaded it) and should tell you what's wrong.
Since you haven't given me a specific example (alongwith your entity structure) all I can point you to is the GQL reference.

Subsonic BatchQuery.Queue causing 'Can't decide which property to consider the key...' exception

I'm just getting started with Subsonic 3.0 ActiveRecord and am trying to implement a batch query like the one in the SubSonic docs. I'm using a batch so I can query a User and a list of the users Orders in one shot.
When I call the BatchQuery.Queue() method, adding my "select user" query, SubSonic throws the following exception:
System.InvalidOperationException : Can't decide which property to consider the Key - you can create one called 'ID' or mark one with SubSonicPrimaryKey attribute
The code is as follows:
var db = new MyDB();
var userQuery = from u in db.Users //gets user by uid
where u.uid == 1
select u;
var provider = ProviderFactory.GetProvider();
var batch = new BatchQuery(provider);
batch.Queue(userQuery); //exception here
//create and add "select users orders" query here...
First things first - Why this error? My SubSonic Users object knows it's PK. "uid" is the PK in the database and the generated code reflects this. And I thought SubSonicPrimaryKey attribute was for the SimpleRepository? Is this way of batching not for ActiveRecord?
I could ask a number of other questions, but I'll leave it at that. If anyone can help me figure out what is going on and how to issue 2 batched queries I'd be grateful!
Edit - after further investigation
I ran through the source code with the debugger. Adam is correct - the ToSchemaTable() method in Objects.cs is apparently building out my schema and failing to find a PK. At the very end, it tries to find a column property named "ID" and flags this as the PK, otherwise it throws the exception. I added a check for "UID" and this works!
Still... I'm confused. I'm admittedly a bit lost after peeling back layer after layer of the source, but it seems like this portion of code is trying to build up a schema for my table and completely ignoring my generated User class - which quite nicely identifies which column/property is the PK! It doesn't seem quite right that I'd be required to name all keys "ID" w/ ActiveRecord.
I think the answer you're looking for is that this is a really stupid bug on my part. I'm hoping to push another build next week and if you could put this on the issue list I'd really appreciate it. My apologies...
SubSonic expects your primary key to be called Id so it's getting confused. SubSonicPrimaryKey is for simple repository but I assume where that exception is being thrown is shared between the different templates. If you rename your PK to Id or id or ID your query will work.

Resources