Logs
Live Cloud Logging query (nothing stored) · master ·
last 6h ·
newest first · page 1 (200/page) · 126 entries in 8242 ms
all
app
neo4j
weaviate
time
relative
absolute
4h ago2026-07-26 19:38:24 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:24 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span0ac978c00537f80c
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 813.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0",
"response_bytes": 31233.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T19:38:24.353Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:24 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:24 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span0ac978c00537f80c
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:24.347Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:24 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:24 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span0ac978c00537f80c
podserver-3-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 0.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "E3F5D133",
"id": "13028664",
"pageFaults": 0.0,
"pageHits": 4.0,
"planning": 0.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:45694\tserver/10.173.0.201:7688\u003e",
"timestamp": "2026-07-26T19:38:24.343Z",
"transactionId": 1739761.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:24 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:24 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span0ac978c00537f80c
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T20:08:24.280Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/117f/117f8a02-1ce8-40b4-89c9-9fbc191fef30_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:24.337Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:24 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:24 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span0ac978c00537f80c
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T20:08:24.212Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/117f/117f8a02-1ce8-40b4-89c9-9fbc191fef30",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:24.280Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:24 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:24 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span0ac978c00537f80c
podserver-1-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3558252.0,
"cpu": 268.0,
"elapsedTimeMs": 269.0,
"executionPlanCacheKeyHash": "DD0BDFD1",
"id": "16846958",
"pageFaults": 0.0,
"pageHits": 3841.0,
"planning": 255.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:37306\tserver/10.173.2.71:7688\u003e",
"timestamp": "2026-07-26T19:38:24.175Z",
"transactionId": 1759925.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:23 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:23 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span0ac978c00537f80c
podserver-3-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9640.0,
"cpu": 1.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "43E58115",
"id": "13028660",
"pageFaults": 0.0,
"pageHits": 18.0,
"planning": 0.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:45694\tserver/10.173.0.201:7688\u003e",
"timestamp": "2026-07-26T19:38:23.547Z",
"transactionId": 1739760.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:23 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:23 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
spand607079497d5082a
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 1024.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/7160534f-22ba-41a7-961f-be9b245373f3",
"response_bytes": 30139.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T19:38:23.412Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:23 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:23 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
spand607079497d5082a
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/7160534f-22ba-41a7-961f-be9b245373f3",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:23.406Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:23 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:23 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
spand607079497d5082a
podserver-1-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 0.0,
"elapsedTimeMs": 0.0,
"executionPlanCacheKeyHash": "94F08FB4",
"id": "16846957",
"pageFaults": 0.0,
"pageHits": 4.0,
"planning": 0.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:37306\tserver/10.173.2.71:7688\u003e",
"timestamp": "2026-07-26T19:38:23.401Z",
"transactionId": 1759924.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:23 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:23 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
spand607079497d5082a
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T20:08:23.333Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/1b30/1b30fb6f-4ad4-49d2-9c5e-12c740993959_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/7160534f-22ba-41a7-961f-be9b245373f3",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:23.395Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:23 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:23 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
spand607079497d5082a
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T20:08:23.286Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/1b30/1b30fb6f-4ad4-49d2-9c5e-12c740993959",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/7160534f-22ba-41a7-961f-be9b245373f3",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:23.332Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:23 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["7160534f-22ba-41a7-961f-be9b245373f3"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:23 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
spand607079497d5082a
podserver-3-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["7160534f-22ba-41a7-961f-be9b245373f3"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3504684.0,
"cpu": 481.0,
"elapsedTimeMs": 503.0,
"executionPlanCacheKeyHash": "9143BC9C",
"id": "13028657",
"pageFaults": 0.0,
"pageHits": 3691.0,
"planning": 478.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"7160534f-22ba-41a7-961f-be9b245373f3\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:45694\tserver/10.173.0.201:7688\u003e",
"timestamp": "2026-07-26T19:38:23.252Z",
"transactionId": 1739758.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:22 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:22 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
spand607079497d5082a
podserver-1-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9636.0,
"cpu": 1.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "674C7A62",
"id": "16846956",
"pageFaults": 0.0,
"pageHits": 18.0,
"planning": 0.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:37306\tserver/10.173.2.71:7688\u003e",
"timestamp": "2026-07-26T19:38:22.393Z",
"transactionId": 1759923.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:22 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:22 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span7bfb1e3a16a64a94
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 793.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/b6d551f1-dab6-49bc-9e25-37ea38258bf5",
"response_bytes": 30304.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T19:38:22.220Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:22 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:22 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span7bfb1e3a16a64a94
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/b6d551f1-dab6-49bc-9e25-37ea38258bf5",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:22.212Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:22 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:22 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span7bfb1e3a16a64a94
podserver-3-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 0.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "E3F5D133",
"id": "13028655",
"pageFaults": 0.0,
"pageHits": 4.0,
"planning": 0.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:45694\tserver/10.173.0.201:7688\u003e",
"timestamp": "2026-07-26T19:38:22.207Z",
"transactionId": 1739757.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:22 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:22 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span7bfb1e3a16a64a94
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T20:08:22.144Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/30cb/30cb95ae-1058-4668-be4f-b9d46a920e33_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/b6d551f1-dab6-49bc-9e25-37ea38258bf5",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:22.201Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:22 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:22 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span7bfb1e3a16a64a94
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T20:08:22.088Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/30cb/30cb95ae-1058-4668-be4f-b9d46a920e33",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/b6d551f1-dab6-49bc-9e25-37ea38258bf5",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:22.144Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:22 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["b6d551f1-dab6-49bc-9e25-37ea38258bf5"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:22 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span7bfb1e3a16a64a94
podserver-1-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["b6d551f1-dab6-49bc-9e25-37ea38258bf5"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3560124.0,
"cpu": 265.0,
"elapsedTimeMs": 266.0,
"executionPlanCacheKeyHash": "DD0BDFD1",
"id": "16846954",
"pageFaults": 0.0,
"pageHits": 3817.0,
"planning": 249.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"b6d551f1-dab6-49bc-9e25-37ea38258bf5\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:37306\tserver/10.173.2.71:7688\u003e",
"timestamp": "2026-07-26T19:38:22.053Z",
"transactionId": 1759922.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:21 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:21 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span7bfb1e3a16a64a94
podserver-3-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9640.0,
"cpu": 1.0,
"elapsedTimeMs": 2.0,
"executionPlanCacheKeyHash": "43E58115",
"id": "13028654",
"pageFaults": 0.0,
"pageHits": 18.0,
"planning": 0.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:45694\tserver/10.173.0.201:7688\u003e",
"timestamp": "2026-07-26T19:38:21.434Z",
"transactionId": 1739756.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:21 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:21 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span194a25c653bb80d4
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 1019.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/5b3d18b6-787c-4816-9058-89eb2ace1257",
"response_bytes": 30218.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T19:38:21.310Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:21 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:21 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span194a25c653bb80d4
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/5b3d18b6-787c-4816-9058-89eb2ace1257",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:21.304Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:21 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:21 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span194a25c653bb80d4
podserver-1-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 0.0,
"elapsedTimeMs": 0.0,
"executionPlanCacheKeyHash": "94F08FB4",
"id": "16846952",
"pageFaults": 0.0,
"pageHits": 4.0,
"planning": 0.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:37306\tserver/10.173.2.71:7688\u003e",
"timestamp": "2026-07-26T19:38:21.300Z",
"transactionId": 1759921.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:21 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:21 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span194a25c653bb80d4
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T20:08:21.230Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/bea5/bea53e6b-cc16-4a4d-ab9e-1bab9d251c8e_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/5b3d18b6-787c-4816-9058-89eb2ace1257",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:21.294Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:21 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:21 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span194a25c653bb80d4
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T20:08:21.183Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/bea5/bea53e6b-cc16-4a4d-ab9e-1bab9d251c8e",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/5b3d18b6-787c-4816-9058-89eb2ace1257",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:21.230Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:21 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["5b3d18b6-787c-4816-9058-89eb2ace1257"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:21 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span194a25c653bb80d4
podserver-3-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["5b3d18b6-787c-4816-9058-89eb2ace1257"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3538364.0,
"cpu": 478.0,
"elapsedTimeMs": 486.0,
"executionPlanCacheKeyHash": "9143BC9C",
"id": "13028653",
"pageFaults": 0.0,
"pageHits": 4366.0,
"planning": 455.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"5b3d18b6-787c-4816-9058-89eb2ace1257\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:45694\tserver/10.173.0.201:7688\u003e",
"timestamp": "2026-07-26T19:38:21.149Z",
"transactionId": 1739755.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:20 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:20 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span194a25c653bb80d4
podserver-1-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9636.0,
"cpu": 5.0,
"elapsedTimeMs": 6.0,
"executionPlanCacheKeyHash": "674C7A62",
"id": "16846947",
"pageFaults": 0.0,
"pageHits": 40.0,
"planning": 5.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:37306\tserver/10.173.2.71:7688\u003e",
"timestamp": "2026-07-26T19:38:20.302Z",
"transactionId": 1759920.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:20 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:20 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span014f737c9783bfb6
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 808.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2",
"response_bytes": 30254.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T19:38:20.111Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:20 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:20 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span014f737c9783bfb6
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:20.103Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:20 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:20 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span014f737c9783bfb6
podserver-3-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 5.0,
"elapsedTimeMs": 5.0,
"executionPlanCacheKeyHash": "E3F5D133",
"id": "13028650",
"pageFaults": 0.0,
"pageHits": 12.0,
"planning": 4.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:45694\tserver/10.173.0.201:7688\u003e",
"timestamp": "2026-07-26T19:38:20.099Z",
"transactionId": 1739754.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:20 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:20 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span014f737c9783bfb6
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T20:08:20.023Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/ca03/ca03dec0-5c2e-4e5d-b124-acad5f67c1d2_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:20.087Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:20 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:20 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span014f737c9783bfb6
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T20:08:19.962Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/ca03/ca03dec0-5c2e-4e5d-b124-acad5f67c1d2",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:20.023Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:19 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:19 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span014f737c9783bfb6
podserver-1-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3556572.0,
"cpu": 262.0,
"elapsedTimeMs": 263.0,
"executionPlanCacheKeyHash": "DD0BDFD1",
"id": "16846944",
"pageFaults": 0.0,
"pageHits": 3778.0,
"planning": 248.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:37306\tserver/10.173.2.71:7688\u003e",
"timestamp": "2026-07-26T19:38:19.934Z",
"transactionId": 1759919.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:19 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:19 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
span014f737c9783bfb6
podserver-3-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9640.0,
"cpu": 1.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "43E58115",
"id": "13028641",
"pageFaults": 0.0,
"pageHits": 18.0,
"planning": 0.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:45694\tserver/10.173.0.201:7688\u003e",
"timestamp": "2026-07-26T19:38:19.308Z",
"transactionId": 1739753.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:19 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:19 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
spanc0e412765da94057
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 1053.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/c26822a4-aefd-4a6a-938f-c61a0fc78329",
"response_bytes": 30113.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T19:38:19.104Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:19 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:19 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
spanc0e412765da94057
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/c26822a4-aefd-4a6a-938f-c61a0fc78329",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:19.098Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:19 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:19 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
spanc0e412765da94057
podserver-1-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 3.0,
"elapsedTimeMs": 3.0,
"executionPlanCacheKeyHash": "94F08FB4",
"id": "16846939",
"pageFaults": 0.0,
"pageHits": 12.0,
"planning": 3.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:37306\tserver/10.173.2.71:7688\u003e",
"timestamp": "2026-07-26T19:38:19.094Z",
"transactionId": 1759918.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:19 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:19 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
spanc0e412765da94057
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T20:08:19.024Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/b29b/b29bb213-7e07-46ea-ae61-be0ddd0ab7ca_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/c26822a4-aefd-4a6a-938f-c61a0fc78329",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:19.082Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:19 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:19 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
spanc0e412765da94057
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T20:08:18.811Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/b29b/b29bb213-7e07-46ea-ae61-be0ddd0ab7ca",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/c26822a4-aefd-4a6a-938f-c61a0fc78329",
"service": "docsvc",
"timestamp": "2026-07-26T19:38:19.024Z",
"user_email": "[email protected]",
"version": "unknown"
}4h ago2026-07-26 19:38:18 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["c26822a4-aefd-4a6a-938f-c61a0fc78329"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:18 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
spanc0e412765da94057
podserver-1-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["c26822a4-aefd-4a6a-938f-c61a0fc78329"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3519916.0,
"cpu": 283.0,
"elapsedTimeMs": 284.0,
"executionPlanCacheKeyHash": "DD0BDFD1",
"id": "16846925",
"pageFaults": 0.0,
"pageHits": 4341.0,
"planning": 264.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"c26822a4-aefd-4a6a-938f-c61a0fc78329\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:37306\tserver/10.173.2.71:7688\u003e",
"timestamp": "2026-07-26T19:38:18.774Z",
"transactionId": 1759883.0,
"waiting": 0.0
}4h ago2026-07-26 19:38:18 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=5aea4de6c2ca41da…
open trace flow ›
time2026-07-26 19:38:18 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace5aea4de6c2ca41da518cd3cfa6e6d8a7
spanc0e412765da94057
podserver-3-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9640.0,
"cpu": 9.0,
"elapsedTimeMs": 9.0,
"executionPlanCacheKeyHash": "43E58115",
"id": "13028631",
"pageFaults": 0.0,
"pageHits": 40.0,
"planning": 7.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tneo4j-java/5.28.13-24cd0fecc64de123fd5711190246e8b0f1e16fd0\t\tclient/10.173.0.8:45694\tserver/10.173.0.201:7688\u003e",
"timestamp": "2026-07-26T19:38:18.116Z",
"transactionId": 1739748.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:22 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:22 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
spanc5501447dca9d371
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 408.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/b6d551f1-dab6-49bc-9e25-37ea38258bf5",
"response_bytes": 30311.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T18:46:22.095Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:22 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:22 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
spanc5501447dca9d371
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/b6d551f1-dab6-49bc-9e25-37ea38258bf5",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:22.089Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:22 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:22 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
spanc5501447dca9d371
podserver-1-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 0.0,
"elapsedTimeMs": 0.0,
"executionPlanCacheKeyHash": "94F08FB4",
"id": "16810343",
"pageFaults": 0.0,
"pageHits": 4.0,
"planning": 0.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:22.087Z",
"transactionId": 1757306.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:22 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:22 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
spanc5501447dca9d371
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T19:16:22.032Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/30cb/30cb95ae-1058-4668-be4f-b9d46a920e33_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/b6d551f1-dab6-49bc-9e25-37ea38258bf5",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:22.082Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:22 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:22 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
spanc5501447dca9d371
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T19:16:21.970Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/30cb/30cb95ae-1058-4668-be4f-b9d46a920e33",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/b6d551f1-dab6-49bc-9e25-37ea38258bf5",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:22.032Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:21 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["b6d551f1-dab6-49bc-9e25-37ea38258bf5"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:21 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
spanc5501447dca9d371
podserver-1-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["b6d551f1-dab6-49bc-9e25-37ea38258bf5"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3560124.0,
"cpu": 255.0,
"elapsedTimeMs": 256.0,
"executionPlanCacheKeyHash": "DD0BDFD1",
"id": "16810342",
"pageFaults": 0.0,
"pageHits": 3817.0,
"planning": 242.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"b6d551f1-dab6-49bc-9e25-37ea38258bf5\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:21.954Z",
"transactionId": 1757305.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:21 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:21 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
spanc5501447dca9d371
podserver-1-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9636.0,
"cpu": 1.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "674C7A62",
"id": "16810341",
"pageFaults": 0.0,
"pageHits": 18.0,
"planning": 0.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:21.691Z",
"transactionId": 1757304.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:21 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:21 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
span6ef2c3e8bb8f11dc
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 426.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/5b3d18b6-787c-4816-9058-89eb2ace1257",
"response_bytes": 30215.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T18:46:21.529Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:21 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:21 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
span6ef2c3e8bb8f11dc
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/5b3d18b6-787c-4816-9058-89eb2ace1257",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:21.523Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:21 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:21 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
span6ef2c3e8bb8f11dc
podserver-1-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 0.0,
"elapsedTimeMs": 0.0,
"executionPlanCacheKeyHash": "94F08FB4",
"id": "16810340",
"pageFaults": 0.0,
"pageHits": 4.0,
"planning": 0.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:21.521Z",
"transactionId": 1757303.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:21 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:21 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
span6ef2c3e8bb8f11dc
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T19:16:21.441Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/bea5/bea53e6b-cc16-4a4d-ab9e-1bab9d251c8e_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/5b3d18b6-787c-4816-9058-89eb2ace1257",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:21.517Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:21 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:21 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
span6ef2c3e8bb8f11dc
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T19:16:21.392Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/bea5/bea53e6b-cc16-4a4d-ab9e-1bab9d251c8e",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/5b3d18b6-787c-4816-9058-89eb2ace1257",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:21.441Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:21 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["5b3d18b6-787c-4816-9058-89eb2ace1257"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:21 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
span6ef2c3e8bb8f11dc
podserver-1-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["5b3d18b6-787c-4816-9058-89eb2ace1257"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3538620.0,
"cpu": 256.0,
"elapsedTimeMs": 256.0,
"executionPlanCacheKeyHash": "DD0BDFD1",
"id": "16810338",
"pageFaults": 0.0,
"pageHits": 3768.0,
"planning": 242.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"5b3d18b6-787c-4816-9058-89eb2ace1257\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:21.371Z",
"transactionId": 1757302.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:21 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:21 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
span6ef2c3e8bb8f11dc
podserver-1-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9636.0,
"cpu": 0.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "674C7A62",
"id": "16810337",
"pageFaults": 0.0,
"pageHits": 18.0,
"planning": 0.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:21.107Z",
"transactionId": 1757301.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:20 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:20 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
span11b29d393553ec59
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 459.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/c26822a4-aefd-4a6a-938f-c61a0fc78329",
"response_bytes": 30106.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T18:46:20.965Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:20 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:20 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
span11b29d393553ec59
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/c26822a4-aefd-4a6a-938f-c61a0fc78329",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:20.959Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:20 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:20 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
span11b29d393553ec59
podserver-1-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 0.0,
"elapsedTimeMs": 0.0,
"executionPlanCacheKeyHash": "94F08FB4",
"id": "16810336",
"pageFaults": 0.0,
"pageHits": 4.0,
"planning": 0.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:20.957Z",
"transactionId": 1757300.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:20 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:20 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
span11b29d393553ec59
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T19:16:20.897Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/b29b/b29bb213-7e07-46ea-ae61-be0ddd0ab7ca_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/c26822a4-aefd-4a6a-938f-c61a0fc78329",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:20.953Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:20 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:20 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
span11b29d393553ec59
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T19:16:20.815Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/b29b/b29bb213-7e07-46ea-ae61-be0ddd0ab7ca",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/c26822a4-aefd-4a6a-938f-c61a0fc78329",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:20.897Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:20 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["c26822a4-aefd-4a6a-938f-c61a0fc78329"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:20 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
span11b29d393553ec59
podserver-1-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["c26822a4-aefd-4a6a-938f-c61a0fc78329"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3519916.0,
"cpu": 278.0,
"elapsedTimeMs": 279.0,
"executionPlanCacheKeyHash": "DD0BDFD1",
"id": "16810332",
"pageFaults": 0.0,
"pageHits": 3743.0,
"planning": 263.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"c26822a4-aefd-4a6a-938f-c61a0fc78329\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:20.797Z",
"transactionId": 1757299.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:20 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:20 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
span11b29d393553ec59
podserver-1-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9636.0,
"cpu": 1.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "674C7A62",
"id": "16810331",
"pageFaults": 0.0,
"pageHits": 18.0,
"planning": 0.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:20.510Z",
"transactionId": 1757298.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:20 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:20 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
spand5d94ae0cc1b61f9
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 408.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0",
"response_bytes": 31237.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T18:46:20.385Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:20 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:20 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
spand5d94ae0cc1b61f9
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:20.378Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:20 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:20 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
spand5d94ae0cc1b61f9
podserver-1-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 0.0,
"elapsedTimeMs": 0.0,
"executionPlanCacheKeyHash": "94F08FB4",
"id": "16810329",
"pageFaults": 0.0,
"pageHits": 4.0,
"planning": 0.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:20.376Z",
"transactionId": 1757297.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:20 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:20 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
spand5d94ae0cc1b61f9
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T19:16:20.322Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/117f/117f8a02-1ce8-40b4-89c9-9fbc191fef30_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:20.372Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:20 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:20 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
spand5d94ae0cc1b61f9
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T19:16:20.265Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/117f/117f8a02-1ce8-40b4-89c9-9fbc191fef30",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:20.322Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:20 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:20 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
spand5d94ae0cc1b61f9
podserver-1-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3558252.0,
"cpu": 258.0,
"elapsedTimeMs": 259.0,
"executionPlanCacheKeyHash": "DD0BDFD1",
"id": "16810316",
"pageFaults": 0.0,
"pageHits": 3841.0,
"planning": 244.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:20.246Z",
"transactionId": 1757296.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:19 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:19 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
spand5d94ae0cc1b61f9
podserver-1-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9636.0,
"cpu": 1.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "674C7A62",
"id": "16810315",
"pageFaults": 0.0,
"pageHits": 18.0,
"planning": 0.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:19.981Z",
"transactionId": 1757295.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:19 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:19 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
spanb5956672014f00fe
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 422.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/7160534f-22ba-41a7-961f-be9b245373f3",
"response_bytes": 30139.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T18:46:19.833Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:19 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:19 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
spanb5956672014f00fe
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/7160534f-22ba-41a7-961f-be9b245373f3",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:19.827Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:19 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:19 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
spanb5956672014f00fe
podserver-1-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 0.0,
"elapsedTimeMs": 0.0,
"executionPlanCacheKeyHash": "94F08FB4",
"id": "16810314",
"pageFaults": 0.0,
"pageHits": 4.0,
"planning": 0.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:19.825Z",
"transactionId": 1757294.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:19 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:19 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
spanb5956672014f00fe
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T19:16:19.748Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/1b30/1b30fb6f-4ad4-49d2-9c5e-12c740993959_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/7160534f-22ba-41a7-961f-be9b245373f3",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:19.821Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:19 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:19 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
spanb5956672014f00fe
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T19:16:19.693Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/1b30/1b30fb6f-4ad4-49d2-9c5e-12c740993959",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/7160534f-22ba-41a7-961f-be9b245373f3",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:19.748Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:19 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["7160534f-22ba-41a7-961f-be9b245373f3"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:19 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
spanb5956672014f00fe
podserver-1-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["7160534f-22ba-41a7-961f-be9b245373f3"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3504940.0,
"cpu": 254.0,
"elapsedTimeMs": 254.0,
"executionPlanCacheKeyHash": "DD0BDFD1",
"id": "16810311",
"pageFaults": 0.0,
"pageHits": 3691.0,
"planning": 241.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"7160534f-22ba-41a7-961f-be9b245373f3\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:19.677Z",
"transactionId": 1757293.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:19 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:19 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
spanb5956672014f00fe
podserver-1-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9636.0,
"cpu": 1.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "674C7A62",
"id": "16810310",
"pageFaults": 0.0,
"pageHits": 18.0,
"planning": 1.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:19.415Z",
"transactionId": 1757292.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:19 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:19 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
span4b240051ad236a43
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 537.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2",
"response_bytes": 30251.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T18:46:19.174Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:19 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:19 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
span4b240051ad236a43
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:19.162Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:19 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:19 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
span4b240051ad236a43
podserver-1-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 3.0,
"elapsedTimeMs": 3.0,
"executionPlanCacheKeyHash": "94F08FB4",
"id": "16810305",
"pageFaults": 0.0,
"pageHits": 12.0,
"planning": 3.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:19.160Z",
"transactionId": 1757290.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:19 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:19 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
span4b240051ad236a43
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T19:16:19.099Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/ca03/ca03dec0-5c2e-4e5d-b124-acad5f67c1d2_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:19.153Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:19 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:19 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace54781c3cf7da713f2b4fff1453222ab9
span4b240051ad236a43
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T19:16:19.047Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/ca03/ca03dec0-5c2e-4e5d-b124-acad5f67c1d2",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2",
"service": "docsvc",
"timestamp": "2026-07-26T18:46:19.099Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:46:19 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:19 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
span4b240051ad236a43
podserver-1-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3556572.0,
"cpu": 279.0,
"elapsedTimeMs": 280.0,
"executionPlanCacheKeyHash": "DD0BDFD1",
"id": "16810304",
"pageFaults": 0.0,
"pageHits": 4376.0,
"planning": 262.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:19.024Z",
"transactionId": 1757289.0,
"waiting": 0.0
}5h ago2026-07-26 18:46:18 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=54781c3cf7da713f…
open trace flow ›
time2026-07-26 18:46:18 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace54781c3cf7da713f2b4fff1453222ab9
span4b240051ad236a43
podserver-1-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9636.0,
"cpu": 63.0,
"elapsedTimeMs": 63.0,
"executionPlanCacheKeyHash": "674C7A62",
"id": "16810301",
"pageFaults": 0.0,
"pageHits": 200.0,
"planning": 60.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:60070\tserver/10.173.2.71:7687\u003e",
"timestamp": "2026-07-26T18:46:18.737Z",
"transactionId": 1757286.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:22 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:22 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
spane662765f9758b261
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 646.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0",
"response_bytes": 31237.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T18:22:22.336Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:22 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:22 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
spane662765f9758b261
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:22.329Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:22 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:22 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
spane662765f9758b261
podserver-3-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 0.0,
"elapsedTimeMs": 0.0,
"executionPlanCacheKeyHash": "E3F5D133",
"id": "12940898",
"pageFaults": 0.0,
"pageHits": 4.0,
"planning": 0.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:22.327Z",
"transactionId": 1736986.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:22 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:22 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
spane662765f9758b261
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T18:52:22.267Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/117f/117f8a02-1ce8-40b4-89c9-9fbc191fef30_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:22.323Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:22 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:22 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
spane662765f9758b261
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T18:52:22.190Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/117f/117f8a02-1ce8-40b4-89c9-9fbc191fef30",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:22.266Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:22 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:22 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
spane662765f9758b261
podserver-3-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3557996.0,
"cpu": 459.0,
"elapsedTimeMs": 460.0,
"executionPlanCacheKeyHash": "9143BC9C",
"id": "12940897",
"pageFaults": 0.0,
"pageHits": 3841.0,
"planning": 436.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"bfcd6fc6-f6c6-4535-b7e4-69de5b9de0b0\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:22.163Z",
"transactionId": 1736985.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:21 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:21 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
spane662765f9758b261
podserver-3-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9640.0,
"cpu": 1.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "43E58115",
"id": "12940896",
"pageFaults": 0.0,
"pageHits": 18.0,
"planning": 0.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:21.695Z",
"transactionId": 1736984.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:21 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:21 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
spanca0e02d163f104e9
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 607.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/7160534f-22ba-41a7-961f-be9b245373f3",
"response_bytes": 30143.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T18:22:21.564Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:21 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:21 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
spanca0e02d163f104e9
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/7160534f-22ba-41a7-961f-be9b245373f3",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:21.558Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:21 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:21 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
spanca0e02d163f104e9
podserver-3-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 0.0,
"elapsedTimeMs": 0.0,
"executionPlanCacheKeyHash": "E3F5D133",
"id": "12940894",
"pageFaults": 0.0,
"pageHits": 4.0,
"planning": 0.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:21.555Z",
"transactionId": 1736983.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:21 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:21 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
spanca0e02d163f104e9
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T18:52:21.495Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/1b30/1b30fb6f-4ad4-49d2-9c5e-12c740993959_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/7160534f-22ba-41a7-961f-be9b245373f3",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:21.551Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:21 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:21 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
spanca0e02d163f104e9
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T18:52:21.445Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/1b30/1b30fb6f-4ad4-49d2-9c5e-12c740993959",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/7160534f-22ba-41a7-961f-be9b245373f3",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:21.495Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:21 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["7160534f-22ba-41a7-961f-be9b245373f3"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:21 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
spanca0e02d163f104e9
podserver-3-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["7160534f-22ba-41a7-961f-be9b245373f3"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3504684.0,
"cpu": 459.0,
"elapsedTimeMs": 460.0,
"executionPlanCacheKeyHash": "9143BC9C",
"id": "12940892",
"pageFaults": 0.0,
"pageHits": 3691.0,
"planning": 436.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"7160534f-22ba-41a7-961f-be9b245373f3\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:21.428Z",
"transactionId": 1736982.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:20 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:20 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
spanca0e02d163f104e9
podserver-3-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9640.0,
"cpu": 1.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "43E58115",
"id": "12940891",
"pageFaults": 0.0,
"pageHits": 18.0,
"planning": 0.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:20.961Z",
"transactionId": 1736981.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:20 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:20 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
span116fce929660383c
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 1105.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/b6d551f1-dab6-49bc-9e25-37ea38258bf5",
"response_bytes": 30305.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T18:22:20.826Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:20 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:20 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
span116fce929660383c
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/b6d551f1-dab6-49bc-9e25-37ea38258bf5",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:20.820Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:20 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:20 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
span116fce929660383c
podserver-3-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 0.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "E3F5D133",
"id": "12940890",
"pageFaults": 0.0,
"pageHits": 4.0,
"planning": 0.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:20.818Z",
"transactionId": 1736980.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:20 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:20 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
span116fce929660383c
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T18:52:20.756Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/30cb/30cb95ae-1058-4668-be4f-b9d46a920e33_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/b6d551f1-dab6-49bc-9e25-37ea38258bf5",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:20.814Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:20 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:20 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
span116fce929660383c
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T18:52:20.702Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/30cb/30cb95ae-1058-4668-be4f-b9d46a920e33",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/b6d551f1-dab6-49bc-9e25-37ea38258bf5",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:20.756Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:20 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["b6d551f1-dab6-49bc-9e25-37ea38258bf5"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:20 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
span116fce929660383c
podserver-3-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["b6d551f1-dab6-49bc-9e25-37ea38258bf5"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3559868.0,
"cpu": 948.0,
"elapsedTimeMs": 949.0,
"executionPlanCacheKeyHash": "9143BC9C",
"id": "12940875",
"pageFaults": 0.0,
"pageHits": 3817.0,
"planning": 926.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"b6d551f1-dab6-49bc-9e25-37ea38258bf5\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:20.683Z",
"transactionId": 1736979.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:19 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:19 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
span116fce929660383c
podserver-3-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9640.0,
"cpu": 1.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "43E58115",
"id": "12940874",
"pageFaults": 0.0,
"pageHits": 18.0,
"planning": 0.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:19.726Z",
"transactionId": 1736978.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:19 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:19 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
span2027a594bb3dd601
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 587.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/5b3d18b6-787c-4816-9058-89eb2ace1257",
"response_bytes": 30214.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T18:22:19.571Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:19 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:19 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
span2027a594bb3dd601
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/5b3d18b6-787c-4816-9058-89eb2ace1257",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:19.565Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:19 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:19 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
span2027a594bb3dd601
podserver-3-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 0.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "E3F5D133",
"id": "12940873",
"pageFaults": 0.0,
"pageHits": 4.0,
"planning": 0.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:19.563Z",
"transactionId": 1736977.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:19 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:19 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
span2027a594bb3dd601
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T18:52:19.537Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/bea5/bea53e6b-cc16-4a4d-ab9e-1bab9d251c8e_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/5b3d18b6-787c-4816-9058-89eb2ace1257",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:19.558Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:19 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:19 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
span2027a594bb3dd601
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T18:52:19.470Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/bea5/bea53e6b-cc16-4a4d-ab9e-1bab9d251c8e",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/5b3d18b6-787c-4816-9058-89eb2ace1257",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:19.537Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:19 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["5b3d18b6-787c-4816-9058-89eb2ace1257"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:19 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
span2027a594bb3dd601
podserver-3-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["5b3d18b6-787c-4816-9058-89eb2ace1257"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3538364.0,
"cpu": 455.0,
"elapsedTimeMs": 455.0,
"executionPlanCacheKeyHash": "9143BC9C",
"id": "12940869",
"pageFaults": 0.0,
"pageHits": 3768.0,
"planning": 429.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"5b3d18b6-787c-4816-9058-89eb2ace1257\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:19.452Z",
"transactionId": 1736976.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:18 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:18 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
span2027a594bb3dd601
podserver-3-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9640.0,
"cpu": 1.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "43E58115",
"id": "12940868",
"pageFaults": 0.0,
"pageHits": 18.0,
"planning": 0.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:18.990Z",
"transactionId": 1736975.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:18 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:18 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
span77051498f051052a
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 680.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2",
"response_bytes": 30250.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T18:22:18.828Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:18 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:18 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
span77051498f051052a
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:18.821Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:18 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:18 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
span77051498f051052a
podserver-3-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 0.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "E3F5D133",
"id": "12940867",
"pageFaults": 0.0,
"pageHits": 4.0,
"planning": 0.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:18.819Z",
"transactionId": 1736974.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:18 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:18 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
span77051498f051052a
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T18:52:18.758Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/ca03/ca03dec0-5c2e-4e5d-b124-acad5f67c1d2_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:18.814Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:18 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:18 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
span77051498f051052a
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T18:52:18.703Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/ca03/ca03dec0-5c2e-4e5d-b124-acad5f67c1d2",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:18.758Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:18 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:18 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
span77051498f051052a
podserver-3-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3556316.0,
"cpu": 465.0,
"elapsedTimeMs": 525.0,
"executionPlanCacheKeyHash": "9143BC9C",
"id": "12940822",
"pageFaults": 0.0,
"pageHits": 3778.0,
"planning": 495.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"d8cb2159-68d4-4ec8-bb2c-70a9d7f37fc2\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:18.684Z",
"transactionId": 1736939.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:18 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:18 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
span77051498f051052a
podserver-3-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9640.0,
"cpu": 1.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "43E58115",
"id": "12940821",
"pageFaults": 0.0,
"pageHits": 18.0,
"planning": 0.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:18.152Z",
"transactionId": 1736938.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:17 UTC INFO docsvc Request completed
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:17 UTC
severityINFO
servicedocsvc
sourceobservability/middleware.go:124
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
spancbc394d39fa9a1cd
poddocsvc-5698bb997f-pc9ql
message
Request completed
raw payload (14 fields)
{
"caller": "observability/middleware.go:124",
"cluster": "master",
"duration_ms": 651.0,
"environment": "DEVELOPMENT",
"message": "Request completed",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/c26822a4-aefd-4a6a-938f-c61a0fc78329",
"response_bytes": 30107.0,
"service": "docsvc",
"status": 200.0,
"timestamp": "2026-07-26T18:22:17.949Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:17 UTC DEBUG docsvc HasStudyRole: error getting study actor
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥DEBUG
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:17 UTC
severityDEBUG
servicedocsvc
sourceauthlib/actors.go:944
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
spancbc394d39fa9a1cd
poddocsvc-5698bb997f-pc9ql
message
HasStudyRole: error getting study actor
raw payload (12 fields)
{
"caller": "authlib/actors.go:944",
"cluster": "master",
"environment": "DEVELOPMENT",
"error": "objLabel Actor: object not found",
"message": "HasStudyRole: error getting study actor",
"method": "GET",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/c26822a4-aefd-4a6a-938f-c61a0fc78329",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:17.938Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:17 UTC neo4j docsvc MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d112...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:17 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
spancbc394d39fa9a1cd
podserver-3-dev-0
query
MATCH(a:Actor{orgId:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf",scopeId:"4f384b37-13c4-4611-8f9a-ce36131ca1eb",userId:"40f468f3-5230-442a-963b-07939d1126ec",delpending:false})
RETURN a
raw payload (15 fields)
{
"allocatedBytes": 312.0,
"cpu": 4.0,
"elapsedTimeMs": 4.0,
"executionPlanCacheKeyHash": "E3F5D133",
"id": "12940820",
"pageFaults": 0.0,
"pageHits": 12.0,
"planning": 3.0,
"query": "MATCH(a:Actor{orgId:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\",scopeId:\"4f384b37-13c4-4611-8f9a-ce36131ca1eb\",userId:\"40f468f3-5230-442a-963b-07939d1126ec\",delpending:false}) RETURN a",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:17.935Z",
"transactionId": 1736937.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:17 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:17 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
spancbc394d39fa9a1cd
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T18:52:17.863Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/b29b/b29bb213-7e07-46ea-ae61-be0ddd0ab7ca_linearized.pdf",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/c26822a4-aefd-4a6a-938f-c61a0fc78329",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:17.927Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:17 UTC INFO docsvc Generated signed URL
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:17 UTC
severityINFO
servicedocsvc
sourcegcs/gcs.go:262
clustermaster
orgteammatesDemoSandbox
versionunknown
trace1f27904c3944cbb54c5d2d19905d40c7
spancbc394d39fa9a1cd
poddocsvc-5698bb997f-pc9ql
message
Generated signed URL
raw payload (14 fields)
{
"bucket": "master-tilda-shared-storage",
"caller": "gcs/gcs.go:262",
"cluster": "master",
"environment": "DEVELOPMENT",
"expiresAt": "2026-07-26T18:52:17.784Z",
"message": "Generated signed URL",
"method": "GET",
"object": "master/teammatesDemoSandbox/b29b/b29bb213-7e07-46ea-ae61-be0ddd0ab7ca",
"org_alias": "teammatesDemoSandbox",
"path": "/api/documents/c26822a4-aefd-4a6a-938f-c61a0fc78329",
"service": "docsvc",
"timestamp": "2026-07-26T18:22:17.863Z",
"user_email": "[email protected]",
"version": "unknown"
}5h ago2026-07-26 18:22:17 UTC neo4j docsvc WITH 1 as total, null as vector MATCH (doc:Document) WHERE doc.tildaid in ["c26822a4-aefd-4a6a-938f-c61a0fc78329"] MATCH...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:17 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
spancbc394d39fa9a1cd
podserver-3-dev-0
query
WITH 1 as total, null as vector MATCH (doc:Document)
WHERE doc.tildaid in ["c26822a4-aefd-4a6a-938f-c61a0fc78329"]
MATCH (org:Organization{tildaid:"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})
CALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }
CALL { with org, doc WITH org, doc as doc0
match (org)<-[:DOC_TO_ORG]-(doc0:Document)
RETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location
union with org, doc WITH org, doc as doc0
match (org)<-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]->(doc0:Document)
RETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }
CALL { RETURN 'ReadWrite' AS docAccessLevel }
CALL {
WITH doc1
RETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:'40f468f3-5230-442a-963b-07939d1126ec'}) } AS isSigner
}
WITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel <> 'NoAccess' OR isSigner)
CALL { WITH doc
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Patient"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi)
OPTIONAL MATCH (patient)<-[:RESEARCH_SUBJECT]->(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, "" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"Site"})-[:BINDER_FOR]-(site:Site)
CALL {
WITH doc, site
OPTIONAL MATCH (study0:Study{tildaid:doc.studyId})<-[:PLAN_DEFINITION_TO_STUDY]-
(pd0:DslPlanDefinition{delpending:false,type:"Site"})-[:PLAN_DEFINITION_TO_SITE]->(site)
OPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]->(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(pd0),
(pi0)-[:FOR_USER]->(piu0:User)
WHERE pi0.state <> "Inactive" AND piu0.status <> "Deleted"
AND ANY(role IN ssa0.roles WHERE role = "principal_investigator")
WITH COALESCE(pd0.siteNumber, "") AS siteNumber,
[n IN collect(DISTINCT CASE
WHEN piu0 IS NULL THEN NULL
WHEN piu0.name IS NOT NULL AND piu0.name <> "" THEN piu0.name
ELSE "(" + piu0.email + ")"
END) WHERE n IS NOT NULL] AS piNames
RETURN siteNumber, piNames
}
OPTIONAL MATCH (doc)<-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in ["Visit", "VisitV2"]
OPTIONAL MATCH (doc)<-[:INCLUDES]-(:Binder{scope:"User"})-[:BINDER_FOR]-(user:User)
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(version:DocumentVersion{tildaid: doc.primaryVersionId})
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})
WITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1
OPTIONAL MATCH (majorDv)-[:UPLOADED_BY]->(uploadedBy:User)
RETURN uploadedBy
}
CALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType
}CALL { return null as signedByUsers , null as reviewDate }
WITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate
CALL { WITH doc
MATCH (doc)<-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)
WITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, 'Received')} as workOrder return collect (distinct workOrder) as workOrders}
CALL { with doc optional match (latestAIRun:AIRun{run_type:"tmf_workflow"})-[:AI_RUN_TO_DOCUMENT_LATEST]->(doc)
with doc, latestAIRun order by latestAIRun.createdat desc limit 1
return case
when latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}
when doc.aiEnabled = true then {status: "pending"}
end as latestAIRun
}
CALL { with doc
optional match (doc)<-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)
return
count(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,
count(DISTINCT CASE WHEN rec.category IN ['Quality Control', 'PHI Issues'] THEN rec END) AS queriesCount,
count(DISTINCT CASE WHEN rec.status = "confirmed" THEN rec END) AS confirmedCount,
count(DISTINCT CASE WHEN rec.status = "resolved" THEN rec END) AS resolvedCount
}
CALL { with doc OPTIONAL MATCH (doc)<-[:INCLUDES]-(b:Binder{binderType:"Tag"})
return apoc.text.join(collect (b.tag), ", ") as tags
}
CALL {
WITH doc, docObj
OPTIONAL MATCH (fold:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(docObj) WHERE (fold.scope="Study" OR fold.scope="Organization")
OPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]->(fold)
RETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, "") <> "" THEN [COALESCE(doc.collection, "")] ELSE [] END as stateTags1
}
CALL {
WITH docObj, path, fold, collection
OPTIONAL MATCH (fold)-[:HAS]->(foldFc:FolderConstraints)
OPTIONAL MATCH (fold)-[:INCLUDES]->(subArtifact:SubArtifact)<-[:FILED_UNDER_SUBARTIFACT]-(docObj)
OPTIONAL MATCH (subArtifact)-[:HAS]->(subFc:FolderConstraints)
WITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds,
CASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints
WITH collection, fold, subArtifact, apoc.text.join(nodeIds, '/') as folderPath, folderConstraints
RETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],
subArtifactId: COALESCE(subArtifact.tildaid, ""), subArtifactName: COALESCE(subArtifact.name, ""),
constraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}
AS primaryFolder
}
CALL {
WITH docObj
optional match (pf:Folder{delpending:false})-[:INCLUDES]->(docObj) WHERE pf.scope="Organization" OR pf.scope="Study" OR (pf.scope="User" AND pf.scopeId="")
optional match path = (:Folder{level:0})-[:INCLUDES*0..4]->(pf)
with pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END] AS nodeIds
with pf, apoc.text.join(nodeIds, '/') as folderPath
with count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders
return case when folderCount=0 THEN [] ELSE folders END as listingFolders
}CALL { with doc
WITH doc, [doc.stateTag] AS stateTags2
RETURN stateTags2, stateTags2 as stagingLabels
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[:REVIEW_IN]->(rt:Task{category:"DocumentSignoff"})
OPTIONAL MATCH (rt)-[:BELONGS_TO]->(i:Inbox{type:"User"})-[:OWNED_BY]-(assignee:User)
WITH rt, CASE WHEN COUNT(assignee) > 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,
profilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees
WITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,
assignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review
ORDER BY review.createdat DESC
RETURN collect(distinct(review)) as reviews
}
CALL {
WITH doc
optional match (doc)-[templateUse:USES_TEMPLATE]->(template:Document)-[:DOC_TO_ORG]-(torg:Organization)
return case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,
currentGeneration: toString(template.generation),
generationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails
}
CALL { with doc, docObj
CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = "" or doc.primaryVersionId is null
optional match (docObj)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (doc)-[:UPLOADED_BY]->(uploader:User)
with doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, uploader, collect(clog) as changeLog
return {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,
versionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,
trackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),
cksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version
union
with doc optional match (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion)
optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
optional match (dv)-[:UPLOADED_BY]->(uploader:User)
optional match (dv)-[:ALL_CHANGELOG]->(c:ChangeLog)
optional match(e: ESignature{tildaid:c.blob})
optional match (dv)-[:PROMOTED_FROM]->(psrc:Document)
with doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc
with doc, dv, ds, psrc, uploader, collect(clog) as changeLog
return case when dv is null then null
else {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,
versionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,
trackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),
linearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,
cksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,
uploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version
// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:
// } with doc, version order by version.majorVersion, version.minorVersion
// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3
} with doc, version order by version.versionNumber
return collect(version) as versions
}
CALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)
optional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)
optional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)
optional match (ann)-[:ALL_CHANGELOG]->(cl:ChangeLog)
with doc, ann, ds, df, cl order by cl.createdat asc
with doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,
collect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog
with doc, ann, auditLog, case when size(signers) <> 0 then signers
when size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,
case when fields is null then [] else fields end as fields1
with doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,
case when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal
return annotationSpec, annotationVal
}
CALL { with doc
optional match (doc)-[p:HAS_QUERY]-(q:Query)
WHERE doc.ownerOrgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf" OR q.orgId = "5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf"
with case when not q is null then {query: q{.*}} end as query
return collect(distinct query) as queries
}
CALL {
WITH docObj
OPTIONAL MATCH (docObj)<-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]->(otherOrg:Organization)
WITH CASE WHEN NOT otherOrg is NULL THEN
{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry
RETURN collect(shareEntry) as sharedWith
}
CALL {
WITH docObj
RETURN CASE WHEN (docObj)-[:REFERS_TO]->(:Document) THEN docObj{.*} ELSE null END as currentShare
}
CALL {
WITH doc
MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})
MATCH (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv)
OPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]->(da:DocAttribute)
OPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]->(dad:DocAttributeDefinition)
RETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, ""), description: COALESCE(dad.description, ""), documentSourceId: ds.tildaid}) as docAttributes
}
CALL {
WITH doc
OPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]->(n:DocumentNote{archived: false})
RETURN count(n) AS notesCount
}
CALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }
CALL {
WITH docObj
OPTIONAL MATCH (docObj)-[cf:COPIED_FROM]->(src:Document)
OPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(src) WHERE (srcFolder.scope="Study" OR srcFolder.scope="Organization")
OPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(srcFolder)
WITH cf, src,
CASE WHEN srcFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as srcFolderPath
WITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath
RETURN CASE WHEN cf IS NULL THEN null ELSE {
documentId: src.tildaid,
collection: src.collection,
folderPath: srcFolderPath,
kind: cf.kind,
stale: cf.sourceVersionId <> src.primaryVersionId,
sourceVersion: COALESCE(src.versionName, toString(src.majorVersion))
} END as copiedFrom
}
CALL {
WITH docObj
OPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]->(docObj)
OPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:"Basic"})-[:INCLUDES]->(child) WHERE (childFolder.scope="Study" OR childFolder.scope="Organization")
OPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]->(childFolder)
OPTIONAL MATCH (st:Study{tildaid:child.studyId})
WITH docObj, ct, child, st,
CASE WHEN childFolder IS NOT NULL THEN
apoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, '0')+ " "+n.name END], '/')
ELSE "" END as childFolderPath
WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath
WITH child, CASE WHEN ct IS NULL THEN null ELSE {
documentId: child.tildaid,
studyId: COALESCE(child.studyId, ""),
studyName: COALESCE(st.name, ""),
folderPath: childFolderPath,
kind: ct.kind,
stale: ct.sourceVersionId <> docObj.primaryVersionId,
version: COALESCE(child.versionName, toString(child.majorVersion))
} END as copiedToEntry
RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount
}
CALL {
WITH doc
OPTIONAL MATCH (doc)<-[:PROMOTED_FROM]-(tv:DocumentVersion)<-[:DOCUMENT_VERSION]-(tgt:Document)
WITH CASE WHEN tgt IS NULL THEN null E…
raw payload (15 fields)
{
"allocatedBytes": 3519660.0,
"cpu": 439.0,
"elapsedTimeMs": 440.0,
"executionPlanCacheKeyHash": "9143BC9C",
"id": "12940819",
"pageFaults": 0.0,
"pageHits": 4337.0,
"planning": 392.0,
"query": "WITH 1 as total, null as vector MATCH (doc:Document)\n\t\t WHERE doc.tildaid in [\"c26822a4-aefd-4a6a-938f-c61a0fc78329\"]\nMATCH (org:Organization{tildaid:\"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"}) OPTIONAL MATCH (study:Study{tildaid:doc.studyId})\nCALL { RETURN [] AS policies, [] AS userSiteIds, [] AS userCountryIds, false AS hasReadOnlyRole }\nCALL { with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_TO_ORG]-(doc0:Document)\n\tRETURN doc0 as doc1, doc0 as docObj, null as docShare, true as owned, null as location\n\tunion with org, doc WITH org, doc as doc0\n\tmatch (org)\u003c-[:DOC_SHARED_TO_ORG]-(docObj:DocumentShare)-[:REFERS_TO]-\u003e(doc0:Document)\n\tRETURN doc0 as doc1, docObj, docObj as docShare, false as owned, null as location }\nCALL { RETURN \u0027ReadWrite\u0027 AS docAccessLevel }\nCALL {\n\t\tWITH doc1\n\t\tRETURN EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:\u002740f468f3-5230-442a-963b-07939d1126ec\u0027}) } AS isSigner\n\t}\nWITH total, vector, doc1 as doc, docObj, owned, study, org, isSigner, docAccessLevel WHERE (docAccessLevel \u003c\u003e \u0027NoAccess\u0027 OR isSigner)\nCALL { WITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Patient\"})-[]-(patient:Patient)-[:HAS_PROTECTED_DATA_IN]-\u003e(phi:Phi)\n\t\t\tOPTIONAL MATCH (patient)\u003c-[:RESEARCH_SUBJECT]-\u003e(cp:CarePlan{studyId:doc.studyId})RETURN DISTINCT patient.tildaid as patientId, \"\" as patientName, cp.subjectid as subjectId}OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"Site\"})-[:BINDER_FOR]-(site:Site)\nCALL {\n\t\t\tWITH doc, site\n\t\t\tOPTIONAL MATCH (study0:Study{tildaid:doc.studyId})\u003c-[:PLAN_DEFINITION_TO_STUDY]-\n\t\t\t\t(pd0:DslPlanDefinition{delpending:false,type:\"Site\"})-[:PLAN_DEFINITION_TO_SITE]-\u003e(site)\n\t\t\tOPTIONAL MATCH (study0)-[:STUDY_TO_ACTOR]-\u003e(pi0:Actor)-[:STUDYSITEACTOR_TO_ACTOR]-(ssa0:StudySiteActor{delpending:false})-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-\u003e(pd0),\n\t\t\t\t(pi0)-[:FOR_USER]-\u003e(piu0:User)\n\t\t\tWHERE pi0.state \u003c\u003e \"Inactive\" AND piu0.status \u003c\u003e \"Deleted\"\n\t\t\t\tAND ANY(role IN ssa0.roles WHERE role = \"principal_investigator\")\n\t\t\tWITH COALESCE(pd0.siteNumber, \"\") AS siteNumber,\n\t\t\t\t[n IN collect(DISTINCT CASE\n\t\t\t\t\tWHEN piu0 IS NULL THEN NULL\n\t\t\t\t\tWHEN piu0.name IS NOT NULL AND piu0.name \u003c\u003e \"\" THEN piu0.name\n\t\t\t\t\tELSE \"(\" + piu0.email + \")\"\n\t\t\t\tEND) WHERE n IS NOT NULL] AS piNames\n\t\t\tRETURN siteNumber, piNames\n\t\t}\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(visitBinder:Binder)-[:BINDER_FOR]-(visit) where visitBinder.scope in [\"Visit\", \"VisitV2\"]\nOPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(:Binder{scope:\"User\"})-[:BINDER_FOR]-(user:User)\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(version:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(majorDv:DocumentVersion{majorVersion: version.majorVersion, minorVersion: 0})\n\t\t\tWITH version, majorDv ORDER BY majorDv.versionNumber ASC LIMIT 1\n\t\t\tOPTIONAL MATCH (majorDv)-[:UPLOADED_BY]-\u003e(uploadedBy:User)\n\t\t\tRETURN uploadedBy\n\t\t}\nCALL { WITH doc OPTIONAL MATCH (docType:DocTypeDetails{name:doc.docTypeName}) return docType\n}CALL { return null as signedByUsers , null as reviewDate }\nWITH distinct total, doc, docObj, vector, owned, study, org, docAccessLevel, isSigner, patientId, patientName, subjectId, site, siteNumber, piNames, visit, user, uploadedBy, docType, signedByUsers, reviewDate\nCALL { WITH doc\n\t\t\tMATCH (doc)\u003c-[r:WORK_ORDER_TO_DOCUMENT]-(wo:WorkOrder)\n\t\t\tWITH doc, {tildaid: wo.tildaid, work_order_id: wo.work_order_id, status: wo.status, documentStatus: COALESCE(r.status, \u0027Received\u0027)} as workOrder return collect (distinct workOrder) as workOrders}\nCALL { with doc optional match (latestAIRun:AIRun{run_type:\"tmf_workflow\"})-[:AI_RUN_TO_DOCUMENT_LATEST]-\u003e(doc)\n\t\t\twith doc, latestAIRun order by latestAIRun.createdat desc limit 1\n\t\t\treturn case\n\t\t\t\twhen latestAIRun is not null then {tildaid: latestAIRun.tildaid, run_type: latestAIRun.run_type, status: latestAIRun.status}\n\t\t\t\twhen doc.aiEnabled = true then {status: \"pending\"}\n\t\t\tend as latestAIRun\n\t\t}\nCALL { with doc\n\t\t optional match (doc)\u003c-[:RECOMMENDATION_TO_DOCUMENT]-(rec:Recommendation)\n\t\t\treturn\n\t\t\tcount(DISTINCT CASE WHEN rec IS NOT NULL THEN rec END) AS findingCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.category IN [\u0027Quality Control\u0027, \u0027PHI Issues\u0027] THEN rec END) AS queriesCount,\n\t\t\tcount(DISTINCT CASE WHEN rec.status = \"confirmed\" THEN rec END) AS confirmedCount,\n \tcount(DISTINCT CASE WHEN rec.status = \"resolved\" THEN rec END) AS resolvedCount\n\t\t}\nCALL { with doc OPTIONAL MATCH (doc)\u003c-[:INCLUDES]-(b:Binder{binderType:\"Tag\"})\n\t\treturn apoc.text.join(collect (b.tag), \", \") as tags\n\t}\nCALL {\n\t\t\tWITH doc, docObj\n\t\t\tOPTIONAL MATCH (fold:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(docObj) WHERE (fold.scope=\"Study\" OR fold.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH path = (collection:Folder{level:0})-[:INCLUDES*0..4]-\u003e(fold)\n\t\t\tRETURN path, fold, collection, CASE WHEN COALESCE(doc.collection, \"\") \u003c\u003e \"\" THEN [COALESCE(doc.collection, \"\")] ELSE [] END as stateTags1\n\t\t}\nCALL {\n\t\t\tWITH docObj, path, fold, collection\n\t\t\tOPTIONAL MATCH (fold)-[:HAS]-\u003e(foldFc:FolderConstraints)\n\t\t\tOPTIONAL MATCH (fold)-[:INCLUDES]-\u003e(subArtifact:SubArtifact)\u003c-[:FILED_UNDER_SUBARTIFACT]-(docObj)\n\t\t\tOPTIONAL MATCH (subArtifact)-[:HAS]-\u003e(subFc:FolderConstraints)\n\t\t\tWITH collection, fold, subArtifact, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds,\n\t\t\t\tCASE WHEN subFc IS NOT NULL THEN subFc ELSE foldFc END as folderConstraints\n\t\t\tWITH collection, fold, subArtifact, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath, folderConstraints\n\t\t\tRETURN {id: fold.tildaid, name: fold.name, number: fold.number, folderType: fold.folderType, folderScope: fold.scope, folderScopeId: fold.scopeId, path: folderPath, mandatoryFields: [], optionalFields: [],\n\t\t\t\tsubArtifactId: COALESCE(subArtifact.tildaid, \"\"), subArtifactName: COALESCE(subArtifact.name, \"\"),\n\t\t\t\tconstraints: CASE WHEN folderConstraints IS NOT NULL THEN folderConstraints{.*} ELSE null END}\n\t\t\tAS primaryFolder\n\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\toptional match (pf:Folder{delpending:false})-[:INCLUDES]-\u003e(docObj) WHERE pf.scope=\"Organization\" OR pf.scope=\"Study\" OR (pf.scope=\"User\" AND pf.scopeId=\"\")\n\t\t\toptional match path = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(pf)\n\t\t\twith pf, [n IN nodes(path) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END] AS nodeIds\n\t\t\twith pf, apoc.text.join(nodeIds, \u0027/\u0027) as folderPath\n\t\t\twith count(pf) as folderCount, collect(distinct({id: pf.tildaid, name: pf.name, folderType: pf.folderType, folderScope: pf.scope, folderScopeId: pf.scopeId, path: folderPath, mandatoryFields: [], optionalFields: []})) as folders\n\t\t\treturn case when folderCount=0 THEN [] ELSE folders END as listingFolders\n\t\t}CALL { with doc\n\tWITH doc, [doc.stateTag] AS stateTags2\n\tRETURN stateTags2, stateTags2 as stagingLabels\n\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[:REVIEW_IN]-\u003e(rt:Task{category:\"DocumentSignoff\"})\n\t\t\tOPTIONAL MATCH (rt)-[:BELONGS_TO]-\u003e(i:Inbox{type:\"User\"})-[:OWNED_BY]-(assignee:User)\n\t\t\tWITH rt, CASE WHEN COUNT(assignee) \u003e 0 THEN collect({tildaid: assignee.tildaid, email: assignee.email, name: assignee.name,\n\t\t\t\tprofilePicURL: assignee.profilePicURL, inboxId: i.tildaid}) ELSE [] END as assignees\n\t\t\tWITH CASE WHEN rt IS NULL THEN NULL ELSE {createdat: rt.createdat, taskId: rt.tildaid, category: rt.category, status: rt.state,\n\t\t\t\tassignees: assignees, closedBy: rt.closedBy, title: rt.title, description: rt.description} END as review\n\t\t\tORDER BY review.createdat DESC\n\t\t\tRETURN collect(distinct(review)) as reviews\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\toptional match (doc)-[templateUse:USES_TEMPLATE]-\u003e(template:Document)-[:DOC_TO_ORG]-(torg:Organization)\n\t\t\treturn case when not template is null then {doc: template{.*}, org: torg{.*}, orgId: torg.tildaid, tildaid: template.tildaid,\n\t\t\t\tcurrentGeneration: toString(template.generation),\n\t\t\t\tgenerationInUse: toString(templateUse.templateGenerationUsed)} else null end as templateDetails\n\t\t}\nCALL { with doc, docObj\n\t\t\tCALL { with doc, docObj with doc, docObj where doc.primaryVersionId = \"\" or doc.primaryVersionId is null\n \t\toptional match (docObj)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (doc)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\twith doc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, uploader, collect(clog) as changeLog\n\t\t\t\treturn {tildaid: doc.tildaid, fileName: doc.fileName, contentType: doc.contentType, date: doc.date, dateType: doc.dateType,\n\t\t\t\tversionName: doc.versionName, rejectReason: doc.rejectReason, language: doc.language, languages: doc.languages, needsAttention: doc.needsAttention, needsAttentionReasons: doc.needsAttentionReasons,\n\t\t\t\ttrackActiveDuplicates: doc.trackActiveDuplicates, versionNumber: doc.versionNumber, majorVersion: doc.majorVersion, minorVersion: doc.minorVersion, generation: toString(doc.generation),\n\t\t\t\tcksum: doc.cksum, size: doc.size, status: doc.status, stateTag: doc.stateTag, pages: doc.pages, uploadMethod: doc.uploadMethod, changeLog: changeLog,\n\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} as version\n\t\t\tunion\n\t\t\t\twith doc optional match (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion)\n\t\t\t\toptional match (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\t\toptional match (dv)-[:UPLOADED_BY]-\u003e(uploader:User)\n\t\t\t\toptional match (dv)-[:ALL_CHANGELOG]-\u003e(c:ChangeLog)\n\t\t\t\toptional match(e: ESignature{tildaid:c.blob})\n\t\t\t\toptional match (dv)-[:PROMOTED_FROM]-\u003e(psrc:Document)\n\t\t\t\twith doc, dv, ds, psrc, uploader, case when not c is null then {changeLog: c{.*}, eSignature: e{.*}} end as clog order by c.createdat asc\n\t\t\t\twith doc, dv, ds, psrc, uploader, collect(clog) as changeLog\n\t\t\t\treturn case when dv is null then null\n\t\t\t\t\telse {tildaid: dv.tildaid, fileName: dv.fileName, contentType: dv.contentType, date: dv.date, dateType: doc.dateType,\n\t\t\t\t\tversionName: dv.versionName, rejectReason: dv.rejectReason, language: dv.language, languages: dv.languages, needsAttention: dv.needsAttention, needsAttentionReasons: dv.needsAttentionReasons,\n\t\t\t\t\ttrackActiveDuplicates: dv.trackActiveDuplicates, versionNumber: dv.versionNumber, majorVersion: dv.majorVersion, minorVersion: dv.minorVersion, documentSourceId: ds.tildaid, promotedFromDocumentId: psrc.tildaid, generation: toString(dv.generation),\n\t\t\t\t\tlinearizedPdfUrl: dv.linearizedPdfUrl, linearizedPdfStatus: dv.linearizedPdfStatus, langDetectionStatus: dv.langDetectionStatus, translatedPdfUrl: dv.translatedPdfUrl, translatedPdfStatus: dv.translatedPdfStatus,\n\t\t\t\t\tcksum: dv.cksum, size: dv.size, status: dv.status, stateTag: dv.stateTag, pages: dv.pages, uploadMethod: dv.uploadMethod, changeLog: changeLog, url: dv.url,\n\t\t\t\t\tuploadedBy: case when uploader is null then null else {id: uploader.tildaid, name: uploader.name, profilePicURL: uploader.profilePicURL} end} end as version\n\t\t\t// TODO: [Major/Minor Versioning] Once client supports minor version UX, update ordering to:\n\t\t\t// } with doc, version order by version.majorVersion, version.minorVersion\n\t\t\t// This will display versions as 1.0, 1.1, 2.0 instead of flat 1, 2, 3\n\t\t\t} with doc, version order by version.versionNumber\n\t\t\t\n\t\t\treturn collect(version) as versions\n\t\t}\nCALL { with doc optional match (doc)-[:HAS]-(ann:DocumentAnnotation)\n\t\t\t\toptional match (ann)-[:ANNOTATION_SIGNER]-(ds:DocumentSigner)\n\t\t\t\toptional match (ann)-[:ANNOTATION_FIELD]-(df:DocumentField)\n\t\t\t\toptional match (ann)-[:ALL_CHANGELOG]-\u003e(cl:ChangeLog)\n\t\t\twith doc, ann, ds, df, cl order by cl.createdat asc\n\t\t\twith doc, ann, apoc.convert.fromJsonList(ann.signers) as signersOld,\n\t\t\t\tcollect(distinct ds{.*}) as signers, collect(distinct df{.*}) as fields, collect(distinct cl{.*}) as auditLog\n\t\t\twith doc, ann, auditLog, case when size(signers) \u003c\u003e 0 then signers\n\t\t\t\twhen size(signers) = 0 and signersOld is null then [] else signersOld end as signers1,\n\t\t\t\tcase when fields is null then [] else fields end as fields1\n\t\t\twith doc, ann{.*, signers: signers1, fields: fields1} as annotationSpec,\n\t\t\t\tcase when doc.template = false then ann{.*, signers: signers1, fields: fields1} else null end as annotationVal\n\t\t\t\treturn annotationSpec, annotationVal\n\t\t}\nCALL { with doc\n\t\t\t\toptional match (doc)-[p:HAS_QUERY]-(q:Query)\n\t\t\t\tWHERE doc.ownerOrgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\" OR q.orgId = \"5026d3b4-4bc1-45e9-a366-b1d4fe1aabcf\"\n\t\t\t\twith case when not q is null then {query: q{.*}} end as query\n\t\t\t\treturn collect(distinct query) as queries\n\t\t\t}\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)\u003c-[:REFERS_TO]-(docShare:DocumentShare)-[:DOC_SHARED_TO_ORG]-\u003e(otherOrg:Organization)\n\t\t\tWITH CASE WHEN NOT otherOrg is NULL THEN\n\t\t\t\t{readerOrg: otherOrg.name, readerOrgId: otherOrg.tildaid, readerOrgAlias: otherOrg.alias, status: docShare.ownerStatus} END as shareEntry\n\t\t\tRETURN collect(shareEntry) as sharedWith\n\t\t\t}\n\t\t\tCALL {\n\t\t\t\tWITH docObj\n\t\t\t\tRETURN CASE WHEN (docObj)-[:REFERS_TO]-\u003e(:Document) THEN docObj{.*} ELSE null END as currentShare\n\t\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tMATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})\n\t\t\tMATCH (doc)-[:DOCUMENT_TO_SOURCE]-\u003e(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]-\u003e(dv)\n\t\t\tOPTIONAL MATCH (ds)-[:HAS_ATTRIBUTE]-\u003e(da:DocAttribute)\n\t\t\tOPTIONAL MATCH (da)-[:HAS_ATTRIBUTE_DEFINITION]-\u003e(dad:DocAttributeDefinition)\n\t\t\tRETURN collect(DISTINCT da{.*, name: COALESCE(dad.name, \"\"), description: COALESCE(dad.description, \"\"), documentSourceId: ds.tildaid}) as docAttributes\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)-[:DOCUMENT_VERSION]-\u003e(dv:DocumentVersion{tildaid: doc.primaryVersionId})-[:HAS_NOTE]-\u003e(n:DocumentNote{archived: false})\n\t\t\tRETURN count(n) AS notesCount\n\t\t}\nCALL { return null as eventId, null as eventName, null as deliverable, null as eventScope }\nCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (docObj)-[cf:COPIED_FROM]-\u003e(src:Document)\n\t\t\tOPTIONAL MATCH (srcFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(src) WHERE (srcFolder.scope=\"Study\" OR srcFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH srcFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(srcFolder)\n\t\t\tWITH cf, src,\n\t\t\t\tCASE WHEN srcFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(srcFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as srcFolderPath\n\t\t\tWITH cf, src, head(collect(srcFolderPath)) AS srcFolderPath\n\t\t\tRETURN CASE WHEN cf IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: src.tildaid,\n\t\t\t\tcollection: src.collection,\n\t\t\t\tfolderPath: srcFolderPath,\n\t\t\t\tkind: cf.kind,\n\t\t\t\tstale: cf.sourceVersionId \u003c\u003e src.primaryVersionId,\n\t\t\t\tsourceVersion: COALESCE(src.versionName, toString(src.majorVersion))\n\t\t\t} END as copiedFrom\n\t\t}\n\t\tCALL {\n\t\t\tWITH docObj\n\t\t\tOPTIONAL MATCH (child:Document)-[ct:COPIED_FROM]-\u003e(docObj)\n\t\t\tOPTIONAL MATCH (childFolder:Folder{delpending:false, folderType:\"Basic\"})-[:INCLUDES]-\u003e(child) WHERE (childFolder.scope=\"Study\" OR childFolder.scope=\"Organization\")\n\t\t\tOPTIONAL MATCH childFolderPath = (:Folder{level:0})-[:INCLUDES*0..4]-\u003e(childFolder)\n\t\t\tOPTIONAL MATCH (st:Study{tildaid:child.studyId})\n\t\t\tWITH docObj, ct, child, st,\n\t\t\t\tCASE WHEN childFolder IS NOT NULL THEN\n\t\t\t\t\tapoc.text.join([n IN nodes(childFolderPath) | CASE WHEN n.number=0 THEN n.name ELSE apoc.text.lpad(toString(COALESCE(n.number, 0)), 2, \u00270\u0027)+ \" \"+n.name END], \u0027/\u0027)\n\t\t\t\tELSE \"\" END as childFolderPath\n\t\t\tWITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath\n\t\t\tWITH child, CASE WHEN ct IS NULL THEN null ELSE {\n\t\t\t\tdocumentId: child.tildaid,\n\t\t\t\tstudyId: COALESCE(child.studyId, \"\"),\n\t\t\t\tstudyName: COALESCE(st.name, \"\"),\n\t\t\t\tfolderPath: childFolderPath,\n\t\t\t\tkind: ct.kind,\n\t\t\t\tstale: ct.sourceVersionId \u003c\u003e docObj.primaryVersionId,\n\t\t\t\tversion: COALESCE(child.versionName, toString(child.majorVersion))\n\t\t\t} END as copiedToEntry\n\t\t\tRETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount\n\t\t}\nCALL {\n\t\t\tWITH doc\n\t\t\tOPTIONAL MATCH (doc)\u003c-[:PROMOTED_FROM]-(tv:DocumentVersion)\u003c-[:DOCUMENT_VERSION]-(tgt:Document)\n\t\t\tWITH CASE WHEN tgt IS NULL THEN null E\u2026",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:17.762Z",
"transactionId": 1736936.0,
"waiting": 0.0
}5h ago2026-07-26 18:22:17 UTC neo4j docsvc MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <>...
filter by:
service=docsvc
user[email protected]
org=teammatesDemoSandbox
severity≥INFO
trace=1f27904c3944cbb5…
open trace flow ›
time2026-07-26 18:22:17 UTC
severityINFO
servicedocsvc
clustermaster
orgteammatesDemoSandbox
trace1f27904c3944cbb54c5d2d19905d40c7
spancbc394d39fa9a1cd
podserver-3-dev-0
query
MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:"[email protected]"})
WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true)
MATCH (o:Organization{delpending:false, alias:"teammatesDemoSandbox"})
return currentUser as user, o as org, currentUser as tokenUser
raw payload (15 fields)
{
"allocatedBytes": 9640.0,
"cpu": 1.0,
"elapsedTimeMs": 1.0,
"executionPlanCacheKeyHash": "43E58115",
"id": "12940817",
"pageFaults": 0.0,
"pageHits": 40.0,
"planning": 0.0,
"query": "MATCH (currentUser:User{deltimestamp:0,deltimestamp:0,email:\"[email protected]\"}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy \u003c\u003e true) MATCH (o:Organization{delpending:false, alias:\"teammatesDemoSandbox\"}) return currentUser as user, o as org, currentUser as tokenUser",
"queryParameters": "{}",
"runtime": "pipelined",
"source": "bolt-session\tbolt\tGo Driver/5.20.0\t\tclient/10.129.3.13:42074\tserver/10.173.0.201:7687\u003e",
"timestamp": "2026-07-26T18:22:17.314Z",
"transactionId": 1736935.0,
"waiting": 0.0
}Paginated with Cloud Logging page cursors, so you can walk the whole 6h window — not just the newest page. Click any filter by value to scope the view (resets to page 1). Paste a trace id to see every log line across all services for that one request.