Question
· Jul 16, 2018

%DOC with DeepSee

Hello,

I have imported my data with the following code (%DocDB).

set filename = "/home/student/Dokumente/convertcsv.json"

IF $SYSTEM.DocDB.Exists("Fitabase1") { 

SET db = ##class(%DocDB.Database).%GetDatabase("Fitabase1")

}

ELSE {

SET db = ##class(%DocDB.Database).%CreateDatabase("Fitabase1") 

}

set arr = ##class(%DynamicAbstractObject).%FromJSON(filename)

SET jstring = arr.%ToJSON()

//SET doccount = db.%Size()

DO db.%FromJSON(jstring) 

Now I have data sets like 

#     ID     %Doc                                                                                                                                                                                                  %DocumentId     %LastModified
1     1     {"Id":1503960366,"ActivityDate":"3/25/2016","TotalSteps":11004,"TotalDistance":7.1100001335144,"Trac...     1     2018-07-16 16:00:50.836
2     2     {"Id":1503960366,"ActivityDate":"3/26/2016","TotalSteps":17609,"TotalDistance":11.5500001907349,"Tra...     2     2018-07-16 16:00:50.837
3     3     {"Id":1503960366,"ActivityDate":"3/27/2016","TotalSteps":12736,"TotalDistance":8.52999973297119,"Tra...     3     2018-07-16 16:00:50.837

1)How can I extract the data from %Doc, for example if I only want the ID or the ActivityDate.

2)Can I use this data in the Analyzer, DeepSee?

Thank you in advance for your help.

Discussion (2)2
Log in or sign up to continue

You should create properties for keys that you want to query. Take a look at this section in the online documentation:

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

Also, there is a brief description in the reference for the %DocDB.Database class:

http://localhost:52773/csp/documatic/%25CSP.Documatic.cls

For example:

USER>s db=$system.DocDB.CreateDatabase("Fitabase1")

USER>w db.%CreateProperty("TotalSteps","%Integer","$.TotalSteps")
2@%DocDB.Database

Now the ISC.DM.Fitabase1 class (or whatever your generated class is) has a TotalSteps property. If you already have data, you need to populate the associated index. A quick and dirty way to do this is an SQL query like the following:

update ISC_DM.Fitabase1 set %Doc = %Doc

I'm not that familiar with DeepSee / Analytics, but the output of %CreateDatabase() and %CreateProperty() is a standard persistent class.