Sample data. This database was generated by scripts/seed_dev_db.py —
every service, deploy, person and figure on this page is synthetic. Names are
sample.*@seed.invalid and image tags are prefixed SEED-.
Nothing here happened.
Query trends 80
stored30h agotop 80 of 4,657
Neo4j query shapes on automation over the last 7d, grouped by plan hash.
Click a column to sort; p95 drift (late-half ÷ early-half of the window) ranks the queries getting slower.
MATCH (doc0:Document{tildaid:$f0}) MATCH (org:Organization{tildaid:$scopeOrgId0}) CALL { WITH org, doc0 UNWIND [x IN $lists.allowedStudies0 WHERE x = doc0.studyId] AS studyId OPTIONAL MATCH (study:Study) WHERE study.tildaid = studyId // An…
MATCH (doc0:Document{tildaid:$f0}) MATCH (org:Organization{tildaid:$scopeOrgId0}) CALL { WITH org, doc0 UNWIND [x IN $lists.allowedStudies0 WHERE x = doc0.studyId] AS studyId OPTIONAL MATCH (study:Study) WHERE study.tildaid = studyId // An inactive actor carries no membership, so it is excluded here rather than at each use: // the sites, countries and roles below all hang off it. OPTIONAL MATCH (study)-[:STUDY_TO_ACTOR]-(studyActor:Actor{orgId:$ctxOrgId0})-[:FOR_USER]->(:User{tildaid:$ctxUserId0}) WHERE studyActor.state <> ? // Collect sites where user has membership in this study OPTIONAL MATCH (studyActor)-[:STUDYSITEACTOR_TO_ACTOR]-(:StudySiteActor)-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]-(pd:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(site:Site) WITH org, study, studyActor, collect(DISTINCT site.tildaid) as userSiteIds // Collect countries where user has membership in this study OPTIONAL MATCH (studyActor)<-[:STUDYCOUNTRYACTOR_TO_ACTOR]-(sca:StudyCountryActor) WITH org, study, studyActor, userSiteIds, collect(DISTINCT sca.country) as userCountryIds // Pre-collect policies for this user/role in this study OPTIONAL MATCH (org)<-[:DOC_ACCESS_POLICY_TO_ORG]-(policy:DocumentAccessPolicy{status:?})-[:POLICY_TO_STUDY]->(study) WHERE EXISTS { MATCH (policy)-[:POLICY_FOR_USER]->(:User{tildaid:$ctxUserId0}) } OR (studyActor IS NOT NULL AND EXISTS { MATCH (policy)-[:POLICY_FOR_ROLE]->(role:Role)<-[:APPOINTED_AS]-(studyActor) }) WITH study, studyActor, userSiteIds, userCountryIds, collect(policy) as policies WITH {study:study, studyActor:studyActor, userSiteIds:userSiteIds, userCountryIds:userCountryIds, policies:policies} AS st WITH collect(distinct st) as studies // studyById lets each document row look its context up by study id instead of scanning // the whole list. Entries whose study did not resolve share the ? key; they all carry // the same empty context, so which one wins does not matter. The node-bearing maps go no // further than this subquery; studyIdsInScope needs no lookup, since an id with no Study // node can never equal a matched study?tildaScale??ReadWrite?ReadOnly?s folder and ancestors (up to ? levels for TMF hierarchy) OPTIONAL MATCH (doc1)<-[:INCLUDES]-(docFolder:Folder) OPTIONAL MATCH (docFolder)<-[:INCLUDES*?..?]-(ancestorFolder:Folder) WITH doc1, policies, userSiteIds, userCountryIds, defaultAccessLevel, collect(DISTINCT docFolder) + collect(DISTINCT ancestorFolder) AS folderHierarchy // Check document ownership OPTIONAL MATCH (doc1)-[:UPLOADED_BY]->(uploader:User{tildaid:$policyUploaderId0}) WITH doc1, policies, userSiteIds, userCountryIds, defaultAccessLevel, folderHierarchy, uploader IS NOT NULL AS isOwnedByUser // Filter policies by: // ?. Folder: policy applies if folder is in hierarchy OR policy has no folder (study-wide). A folder-less // ownership policy is the role?Owned Documents?Non Owned Documents?Staging?Pre-Staging?Owned Documents?Non Owned Documents?My Sites Documents?Other Sites Documents?My Countries Documents?Other Countries Documents?Study Scope Documents?NoAccess?NoAccess?ReadOnly?ReadOnly?ReadWrite?ReadOnly?NoAccess??Inactive' AND sst.tildaid IN studyIdsInScope AND (doc1.siteId = ? OR (a)-[:STUDYSITEACTOR_TO_ACTOR]-(:StudySiteActor)- [:STUDYSITEACTOR_TO_PLAN_DEFINITION]-(:DslPlanDefinition{delpending:false,type:?})- [:PLAN_DEFINITION_TO_SITE]-(:Site{tildaid:doc1.siteId})) RETURN doc1 as doc UNION WITH doc1, studyIdsInScope, directAdmit WITH doc1, studyIdsInScope WHERE NOT directAdmit AND (NOT $nonSiteOnlyPatients0 OR doc1.patientId = ?) AND doc1.siteId <> ? MATCH (s:Site{tildaid:doc1.siteId, delpending:false})-[:PLAN_DEFINITION_TO_SITE]- (pd:DslPlanDefinition{delpending:false,type:?})-[:PLAN_DEFINITION_TO_STUDY]->(sst:Study) WHERE sst.tildaid IN studyIdsInScope RETURN doc1 as doc UNION WITH doc1, directAdmit WITH doc1 WHERE directAdmit RETURN doc1 as doc} WITH ({doc: doc, location: location, docObj: docObj, owned: owned, study: study, org: org, vector: vector, docAccessLevel: docAccessLevel}) as row WITH collect(DISTINCT row) as rows, count(DISTINCT row) as total unwind rows as row WITH row.doc as doc, row.location as location, row.docObj as docObj, row.owned as owned, row.study as study, row.org as org, row.vector as vector, row.docAccessLevel as docAccessLevel, total order by doc.createdat asc, doc.tildaid asc skip $skip0 WITH *, EXISTS { (doc)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:$signerUserId3}) } AS isSigner CALL {return null as patientId, null as patientName, null as subjectId}CALL { return null as site, ? as siteNumber, [] as piNames }CALL { return null as visit }CALL { return null as user }CALL { return null as uploadedBy }CALL { return null as 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 { return null as workOrders, false as woContact, null as latestAIRun, null as findingCount, null as queriesCount, null as confirmedCount, null as resolvedCount }CALL { return null as tags } CALL { return null as path, null as fold, null as collection, null as stateTags1 } CALL { return null as primaryFolder } CALL { return null as listingFolders } CALL { return null as stateTags2, null as stagingLabels } CALL { return [] as reviews} CALL { return null as templateDetails} CALL { with doc, docObj CALL { with doc, docObj with doc, docObj where doc.primaryVersionId = ? or doc.primaryVersionId is null optional match (doc)-[:UPLOADED_BY]->(uploader:User) return {tildaid: doc.tildaid, fileName: doc.fileName, originalFileName: doc.originalFileName, 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: [], createdAt: doc.createdat, renderedCompletedAt: doc.renderedCompletedAt, renderedFieldsRevision: doc.renderedFieldsRevision, renderedSignersRevision: doc.renderedSignersRevision, tmfFiledAt: coalesce(doc.tmfFiledAt, ?), 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) where $versionsSeesPreRedaction0 or coalesce(dv.preRedaction, false) = false or dv.tildaid = doc.primaryVersionId optional match (doc)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:DOCUMENT_SOURCE_TO_VERSION]->(dv) optional match (dv)-[:UPLOADED_BY]->(uploader:User) optional match (dv)-[:PROMOTED_FROM]->(psrc:Document) return case when dv is null then null else {tildaid: dv.tildaid, fileName: dv.fileName, originalFileName: dv.originalFileName, 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, needsProcessedPdf: dv.needsProcessedPdf, 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: [], url: dv.url, createdAt: dv.createdat, renderedCompletedAt: dv.renderedCompletedAt, renderedFieldsRevision: dv.renderedFieldsRevision, renderedSignersRevision: dv.renderedSignersRevision, preRedaction: coalesce(dv.preRedaction, false), tmfFiledAt: coalesce(dv.tmfFiledAt, ?), 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 ?.?, ?.?, ?.? instead of flat ?, ?, ? } with doc, version order by version.versionNumber where $versionsVersionId0 IS NULL OR version.tildaid = $versionsVersionId0 return collect(version) as versions } CALL { return null as annotationSpec, null as annotationVal } CALL { return [] as queries } CALL { return null as sharedWith, null as currentShare } CALL { WITH doc MATCH (doc)-[:DOCUMENT_VERSION]->(dv:DocumentVersion{tildaid: coalesce($docAttrVersionId0, 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: coalesce($notesVersionId0, 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 { return null as copiedFrom } CALL { return [] as copiedTo, ? as copiedToCount } CALL { return null as promotedTo } CALL { return null AS docReviewStatus, null AS hasImportantComment, null AS discrepancyCount } CALL { return null as tmfCategorization } with distinct doc{.*, status: docObj.status, stateTag: docObj.stateTag, orgAlias: org.alias, owned: owned, docTypeName: doc.docTypeName, userId: doc.userId, user: CASE WHEN user IS NOT NULL THEN {id: user.tildaid, name: user.name, profilePicURL: user.profilePicURL} ELSE NULL END, createdDate: doc.createdat, updatedDate: COALESCE(doc.updatedat, doc.createdat), externalUrl: doc.url, study: study.name, studyId: study.tildaid, site: site.name, siteId: doc.siteId, siteNumber: siteNumber, piNames: piNames, patient: patientName, patientId: doc.patientId, subjectId: subjectId, visit: visit.title, visitId: doc.visitId, reviewDate: reviewDate, assignedToUsers: [], uploadedBy: {id: uploadedBy.tildaid, name: uploadedBy.name, profilePicURL: uploadedBy.profilePicURL}, signedByUsers: signedByUsers, tags: tags, listingFolders: listingFolders, primaryFolder: primaryFolder, latestAIRun: latestAIRun, findingCount: findingCount, queriesCount: queriesCount, confirmedCount: confirmedCount, resolvedCount: resolvedCount, notesCount: notesCount, stagingLabels: stagingLabels, workOrders: workOrders, woContact: COALESCE(woContact, false), stateTags1: stateTags1, stateTags2: stateTags2, docAccessLevel: docAccessLevel, isSigner: isSigner, docReviewStatus: docReviewStatus, hasImportantComment: hasImportantComment, discrepancyCount: discrepancyCount , templateDetails: templateDetails, docTypeDetails: docType{.*}, queries: queries, annotationSpec: annotationSpec, annotationVal: annotationVal, completedAt: annotationVal.completedAt, versions: versions, reviews: reviews, sharedWith: sharedWith, currentShare: currentShare, tmfCategorization: tmfCategorization, docAttributes: docAttributes, eventId: eventId, eventName: eventName, deliverable: deliverable, eventScope: eventScope, provenance: CASE WHEN copiedFrom IS NULL AND size(copiedTo) = ? THEN null ELSE {copiedFrom: copiedFrom, copiedTo: [x IN copiedTo WHERE x IS NOT NULL | x], copiedToCount: copiedToCount} END, promotedTo: promotedTo} AS document, total return document, total
docsvc
2
1.26 s
4.70 s
2.50 s
flat
MATCH (u:User{tildaid:$user}), (o:Organization{delpending:false, alias:$org}) CALL (u, o) { OPTIONAL MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o), (a)-[:APPOINTED_AS]->(r:Role) WHERE not r.name = ? AND c…
MATCH (u:User{tildaid:$user}), (o:Organization{delpending:false, alias:$org}) CALL (u, o) { OPTIONAL MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o), (a)-[:APPOINTED_AS]->(r:Role) WHERE not r.name = ? AND coalesce(a.state, ?) <> ? return r{.*} UNION MATCH (u)<-[:FOR_USER]-(da:Actor{delpending:false})<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study{delpending:false})-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(r:Role)<-[:APPOINTED_AS]-(sa:Actor{delpending:false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization{alias:?}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND ? IN apoc.text.split(coalesce(r.tags, ?), ?) return distinct r{.*} } WITH u, o, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles, ANY(n IN COLLECT(r.external) WHERE n = true) as external, ANY(n IN COLLECT(r.name) WHERE n = ?) as isPatient, ALL(n IN COLLECT(r.piiAccess) WHERE n = false) as hidePhi WITH u, o, {organization:o{.*}, external: external, isPatient: isPatient, hidePhi: hidePhi, roles: roles, displayRoles: displayRoles } as context CALL (u, o) { MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:STAFF_TO_ACTOR]-(si:Site{delpending:false})-[:SITE_TO_SMO]->(:Smo)-[:IS_AN_ORG]->(o) WHERE coalesce(a.state, ?) <> ? OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, si, a, r order by r.displayName WITH u, o, si, a, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles WITH CASE when not si is null then {siteId: si.tildaid, roles: roles, displayRoles: displayRoles} end as si return collect(si) as sites, apoc.coll.flatten(collect(si.roles)) as siteRoles } CALL (u, o) { CALL (u, o) { MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false, orgId:o.tildaid}) WHERE coalesce(a.state, ?) <> ? // Required pipeline barrier: without it the actor match re-expands // once per study in the org (?.0M -> 32k db hits, measured in Go). WITH DISTINCT u, o, a MATCH (a)<-[:STUDY_TO_ACTOR]-(s:Study{delpending:false})-[:STUDY_TO_ORG]->(o) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) RETURN s, r UNION // Delegated engagement Actors: orgId is TildaScale? roles. WITH s, r order by r.displayName WITH s, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles // Ordered so the studies array is a stable sequence for clients. WITH s, {studyId: s.tildaid, roles: roles, displayRoles: displayRoles, srcOrgId: s.srcorgid} as st ORDER BY s.name, s.tildaid return collect(st) as studies, apoc.coll.flatten(collect(st.roles)) as studyRoles } with distinct context, studies, apoc.coll.toSet(apoc.coll.flatten(collect(studyRoles))) as allStudyRoles, apoc.coll.toSet(apoc.coll.flatten(collect(siteRoles))) as siRoles with context, studies, apoc.coll.toSet(apoc.coll.flatten([context.roles, allStudyRoles, siRoles])) as allRoles return context{.*, studies: studies, allRoles: allRoles} as rc
virtual-assistant
3
1.00 s
4.55 s
3.00 s
flat
MATCH (dv:DocumentVersion {tildaid: $id})<-[:DOCUMENT_VERSION]-(d:Document) MATCH (r:Recommendation) WHERE r.doc_id = d.tildaid AND NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO…
MATCH (dv:DocumentVersion {tildaid: $id})<-[:DOCUMENT_VERSION]-(d:Document) MATCH (r:Recommendation) WHERE r.doc_id = d.tildaid AND NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO_ORGANIZATION]->(o:Organization) OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (u: User) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) CALL { WITH d, site OPTIONAL MATCH (study:Study{tildaid: d.studyId})<-[:PLAN_DEFINITION_TO_STUDY]- (pd:DslPlanDefinition{delpending:false, type:?})-[:PLAN_DEFINITION_TO_SITE]->(site) RETURN COALESCE(pd.siteNumber, ?) AS siteNumber } CALL { WITH dv OPTIONAL MATCH (dv)<-[:DOCUMENT_SOURCE_TO_VERSION]-(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(docAttr: DocAttribute) WITH collect([coalesce(docAttr.key, ?), coalesce(docAttr.value, ?)]) AS attributePairs WITH apoc.map.fromPairs(attributePairs) AS attributesMap With apoc.convert.toJson(attributesMap) AS attributesJson RETURN attributesJson } WITH r, ai, o, d, dv, zone, section, artifact, subArtifact, u, study, site, siteNumber, attributesJson, // Document Scope key stripping: reduce the rec JSON envelope to the keys // valid for its OWN scope so irrelevant keys (e.g. country on a site rec) // don?scope?country?scope?siteName?siteId?siteNumber?scope?scope???{}?{}?????{}?{?{?{????DRecommendation?t emit irrelevant rows (e.g. country on a site-scoped rec). recommendedValue: CASE WHEN r.category = ? AND recAllowed IS NOT NULL THEN apoc.convert.toJson(apoc.map.fromPairs([k IN keys(recMap) WHERE k IN recAllowed | [k, recMap[k]]])) ELSE coalesce(CASE WHEN coalesce(r.data_formatted, ?) <> ? THEN r.data_formatted END, r.data, ?) END, // originalRecommendation = the AI?Document Scope????Document Metadata?{}??Document Scope???Document Naming??TMF Artifact???.???.??? ??Sub Artifact??Document Scope??country???site?????Document Metadata??Document Metadata?????{}??????{}??{}??Document Scope?????country???site??????Document Naming???????TMF Artifact????????.???.??? ??Sub Artifact???????Document Format?Document Summary?Quality Control?PHI Issues?Confirm?Fix It????' } ) YIELD node RETURN node
writedashrsvc
7
602 ms
4.47 s
2.10 s
flat
MATCH (dv:DocumentVersion {tildaid: $id})<-[:DOCUMENT_VERSION]-(d:Document) MATCH (r:Recommendation) WHERE r.doc_id = d.tildaid AND NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO…
MATCH (dv:DocumentVersion {tildaid: $id})<-[:DOCUMENT_VERSION]-(d:Document) MATCH (r:Recommendation) WHERE r.doc_id = d.tildaid AND NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO_ORGANIZATION]->(o:Organization) OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (u: User) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) CALL { WITH d, site OPTIONAL MATCH (study:Study{tildaid: d.studyId})<-[:PLAN_DEFINITION_TO_STUDY]- (pd:DslPlanDefinition{delpending:false, type:?})-[:PLAN_DEFINITION_TO_SITE]->(site) RETURN COALESCE(pd.siteNumber, ?) AS siteNumber } CALL { WITH dv OPTIONAL MATCH (dv)<-[:DOCUMENT_SOURCE_TO_VERSION]-(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(docAttr: DocAttribute) WITH collect([coalesce(docAttr.key, ?), coalesce(docAttr.value, ?)]) AS attributePairs WITH apoc.map.fromPairs(attributePairs) AS attributesMap With apoc.convert.toJson(attributesMap) AS attributesJson RETURN attributesJson } WITH r, ai, o, d, dv, zone, section, artifact, subArtifact, u, study, site, siteNumber, attributesJson, // Document Scope key stripping: reduce the rec JSON envelope to the keys // valid for its OWN scope so irrelevant keys (e.g. country on a site rec) // don?scope?country?scope?siteName?siteId?siteNumber?scope?scope???{}?{}?????{}?{?{?{????DRecommendation?t emit irrelevant rows (e.g. country on a site-scoped rec). recommendedValue: CASE WHEN r.category = ? AND recAllowed IS NOT NULL THEN apoc.convert.toJson(apoc.map.fromPairs([k IN keys(recMap) WHERE k IN recAllowed | [k, recMap[k]]])) ELSE coalesce(CASE WHEN coalesce(r.data_formatted, ?) <> ? THEN r.data_formatted END, r.data, ?) END, // originalRecommendation = the AI?Document Scope????Document Metadata?{}??Document Scope???Document Naming??TMF Artifact???.???.??? ??Sub Artifact??Document Scope??country???site?????Document Metadata??Document Metadata?????{}??????{}??{}??Document Scope?????country???site??????Document Naming???????TMF Artifact????????.???.??? ??Sub Artifact???????Document Format?Document Summary?Quality Control?PHI Issues?Confirm?Fix It????' } ) YIELD node RETURN node
writedashrsvc
6
406 ms
4.10 s
2.42 s
flat
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Study policies=work-order-edit MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role) WHERE a.state <> ? AN…
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Study policies=work-order-edit MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role) WHERE a.state <> ? AND a.delpending = false AND o.tildaid = a.orgId AND x.name IN $lists.roles_0 WITH DISTINCT u, o, a, c MATCH (a)<-[:STUDY_TO_ACTOR]-(st:Study) WHERE EXISTS { (st)-[:STUDY_TO_ORG]->(o) } AND ( size(c.studyIds) = ? OR st.tildaid IN c.studyIds ) MATCH (wo:WorkOrder {tildaid:c.id}) WHERE wo.study_id = st.tildaid RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, st AS Study, null AS Site, null AS Patient UNION // scope=Study policies=work-order-edit MATCH (u)<-[:FOR_USER]-(da:Actor)<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study)-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(x:Role)<-[:APPOINTED_AS]-(sa:Actor), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias:?}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND da.delpending = false AND sa.state <> ? AND sa.delpending = false AND x.name IN $lists.roles_1 AND ? IN apoc.text.split(coalesce(x.tags, ?), ?) AND ( size(c.studyIds) = ? OR st.tildaid IN c.studyIds ) MATCH (wo:WorkOrder {tildaid:c.id}) WHERE wo.study_id = st.tildaid RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, st AS Study, null AS Site, null AS Patient } RETURN checkIdx, User, Organization, Study, Site, Patient
virtual-assistant
9
369 ms
3.65 s
3.30 s
flat
MATCH (u:User{tildaid:$user}), (o:Organization{delpending:false, alias:$org}) CALL (u, o) { OPTIONAL MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o), (a)-[:APPOINTED_AS]->(r:Role) WHERE not r.name = ? AND c…
MATCH (u:User{tildaid:$user}), (o:Organization{delpending:false, alias:$org}) CALL (u, o) { OPTIONAL MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o), (a)-[:APPOINTED_AS]->(r:Role) WHERE not r.name = ? AND coalesce(a.state, ?) <> ? return r{.*} UNION MATCH (u)<-[:FOR_USER]-(da:Actor{delpending:false})<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study{delpending:false})-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(r:Role)<-[:APPOINTED_AS]-(sa:Actor{delpending:false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization{alias:?}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND ? IN apoc.text.split(coalesce(r.tags, ?), ?) return distinct r{.*} } WITH u, o, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles, ANY(n IN COLLECT(r.external) WHERE n = true) as external, ANY(n IN COLLECT(r.name) WHERE n = ?) as isPatient, ALL(n IN COLLECT(r.piiAccess) WHERE n = false) as hidePhi WITH u, o, {organization:o{.*}, external: external, isPatient: isPatient, hidePhi: hidePhi, roles: roles, displayRoles: displayRoles } as context CALL (u, o) { MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:STAFF_TO_ACTOR]-(si:Site{delpending:false})-[:SITE_TO_SMO]->(:Smo)-[:IS_AN_ORG]->(o) WHERE coalesce(a.state, ?) <> ? OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, si, a, r order by r.displayName WITH u, o, si, a, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles WITH CASE when not si is null then {siteId: si.tildaid, roles: roles, displayRoles: displayRoles} end as si return collect(si) as sites, apoc.coll.flatten(collect(si.roles)) as siteRoles } CALL (u, o) { CALL (u, o) { MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false, orgId:o.tildaid}) WHERE coalesce(a.state, ?) <> ? // Required pipeline barrier: without it the actor match re-expands // once per study in the org (?.0M -> 32k db hits, measured in Go). WITH DISTINCT u, o, a MATCH (a)<-[:STUDY_TO_ACTOR]-(s:Study{delpending:false})-[:STUDY_TO_ORG]->(o) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) RETURN s, r UNION // Delegated engagement Actors: orgId is TildaScale? roles. WITH s, r order by r.displayName WITH s, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles // Ordered so the studies array is a stable sequence for clients. WITH s, {studyId: s.tildaid, roles: roles, displayRoles: displayRoles, srcOrgId: s.srcorgid} as st ORDER BY s.name, s.tildaid return collect(st) as studies, apoc.coll.flatten(collect(st.roles)) as studyRoles } with distinct context, studies, apoc.coll.toSet(apoc.coll.flatten(collect(studyRoles))) as allStudyRoles, apoc.coll.toSet(apoc.coll.flatten(collect(siteRoles))) as siRoles with context, studies, apoc.coll.toSet(apoc.coll.flatten([context.roles, allStudyRoles, siRoles])) as allRoles return context{.*, studies: studies, allRoles: allRoles} as rc
feedsvc
9
269 ms
3.65 s
2.40 s
flat
MATCH (u:User{tildaid:$user}), (o:Organization{delpending:false, alias:$org}) CALL (u, o) { OPTIONAL MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o), (a)-[:APPOINTED_AS]->(r:Role) WHERE not r.name = ? AND c…
MATCH (u:User{tildaid:$user}), (o:Organization{delpending:false, alias:$org}) CALL (u, o) { OPTIONAL MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o), (a)-[:APPOINTED_AS]->(r:Role) WHERE not r.name = ? AND coalesce(a.state, ?) <> ? return r{.*} UNION MATCH (u)<-[:FOR_USER]-(da:Actor{delpending:false})<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study{delpending:false})-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(r:Role)<-[:APPOINTED_AS]-(sa:Actor{delpending:false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization{alias:?}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND ? IN apoc.text.split(coalesce(r.tags, ?), ?) return distinct r{.*} } WITH u, o, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles, ANY(n IN COLLECT(r.external) WHERE n = true) as external, ANY(n IN COLLECT(r.name) WHERE n = ?) as isPatient, ALL(n IN COLLECT(r.piiAccess) WHERE n = false) as hidePhi WITH u, o, {organization:o{.*}, external: external, isPatient: isPatient, hidePhi: hidePhi, roles: roles, displayRoles: displayRoles } as context CALL (u, o) { MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:STAFF_TO_ACTOR]-(si:Site{delpending:false})-[:SITE_TO_SMO]->(:Smo)-[:IS_AN_ORG]->(o) WHERE coalesce(a.state, ?) <> ? OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, si, a, r order by r.displayName WITH u, o, si, a, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles WITH CASE when not si is null then {siteId: si.tildaid, roles: roles, displayRoles: displayRoles} end as si return collect(si) as sites, apoc.coll.flatten(collect(si.roles)) as siteRoles } CALL (u, o) { CALL (u, o) { MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false, orgId:o.tildaid}) WHERE coalesce(a.state, ?) <> ? // Required pipeline barrier: without it the actor match re-expands // once per study in the org (?.0M -> 32k db hits, measured in Go). WITH DISTINCT u, o, a MATCH (a)<-[:STUDY_TO_ACTOR]-(s:Study{delpending:false})-[:STUDY_TO_ORG]->(o) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) RETURN s, r UNION // Delegated engagement Actors: orgId is TildaScale? roles. WITH s, r order by r.displayName WITH s, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles // Ordered so the studies array is a stable sequence for clients. WITH s, {studyId: s.tildaid, roles: roles, displayRoles: displayRoles, srcOrgId: s.srcorgid} as st ORDER BY s.name, s.tildaid return collect(st) as studies, apoc.coll.flatten(collect(st.roles)) as studyRoles } with distinct context, studies, apoc.coll.toSet(apoc.coll.flatten(collect(studyRoles))) as allStudyRoles, apoc.coll.toSet(apoc.coll.flatten(collect(siteRoles))) as siRoles with context, studies, apoc.coll.toSet(apoc.coll.flatten([context.roles, allStudyRoles, siRoles])) as allRoles return context{.*, studies: studies, allRoles: allRoles} as rc
feedsvc
12
196 ms
3.20 s
2.31 s
flat
MATCH (dv:DocumentVersion {tildaid: $id})<-[:DOCUMENT_VERSION]-(d:Document) MATCH (r:Recommendation) WHERE r.doc_id = d.tildaid AND NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO…
MATCH (dv:DocumentVersion {tildaid: $id})<-[:DOCUMENT_VERSION]-(d:Document) MATCH (r:Recommendation) WHERE r.doc_id = d.tildaid AND NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO_ORGANIZATION]->(o:Organization) OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (u: User) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) CALL { WITH d, site OPTIONAL MATCH (study:Study{tildaid: d.studyId})<-[:PLAN_DEFINITION_TO_STUDY]- (pd:DslPlanDefinition{delpending:false, type:?})-[:PLAN_DEFINITION_TO_SITE]->(site) RETURN COALESCE(pd.siteNumber, ?) AS siteNumber } CALL { WITH dv OPTIONAL MATCH (dv)<-[:DOCUMENT_SOURCE_TO_VERSION]-(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(docAttr: DocAttribute) WITH collect([coalesce(docAttr.key, ?), coalesce(docAttr.value, ?)]) AS attributePairs WITH apoc.map.fromPairs(attributePairs) AS attributesMap With apoc.convert.toJson(attributesMap) AS attributesJson RETURN attributesJson } WITH r, ai, o, d, dv, zone, section, artifact, subArtifact, u, study, site, siteNumber, attributesJson, // Document Scope key stripping: reduce the rec JSON envelope to the keys // valid for its OWN scope so irrelevant keys (e.g. country on a site rec) // don?scope?country?scope?siteName?siteId?siteNumber?scope?scope???{}?{}?????{}?{?{?{????DRecommendation?t emit irrelevant rows (e.g. country on a site-scoped rec). recommendedValue: CASE WHEN r.category = ? AND recAllowed IS NOT NULL THEN apoc.convert.toJson(apoc.map.fromPairs([k IN keys(recMap) WHERE k IN recAllowed | [k, recMap[k]]])) ELSE coalesce(CASE WHEN coalesce(r.data_formatted, ?) <> ? THEN r.data_formatted END, r.data, ?) END, // originalRecommendation = the AI?Document Scope????Document Metadata?{}??Document Scope???Document Naming??TMF Artifact???.???.??? ??Sub Artifact??Document Scope??country???site?????Document Metadata??Document Metadata?????{}??????{}??{}??Document Scope?????country???site??????Document Naming???????TMF Artifact????????.???.??? ??Sub Artifact???????Document Format?Document Summary?Quality Control?PHI Issues?Confirm?Fix It????' } ) YIELD node RETURN node
writedashrsvc
19
122 ms
2.15 s
2.28 s
flat
MATCH (u:User{tildaid:$userId}) WHERE u.status<>?OPTIONAL MATCH (u)-[:INTERNAL_DATA]-(ui:UserInternal) WITH u, COALESCE(ui.pinHash IS NOT NULL AND ui.pinHash <> ?, false) AS pinSet, COALESCE(ui.needs2Factor, false) AS needs2Factor WITH u, …
MATCH (u:User{tildaid:$userId}) WHERE u.status<>?OPTIONAL MATCH (u)-[:INTERNAL_DATA]-(ui:UserInternal) WITH u, COALESCE(ui.pinHash IS NOT NULL AND ui.pinHash <> ?, false) AS pinSet, COALESCE(ui.needs2Factor, false) AS needs2Factor WITH u, u{.*, pinSet: pinSet, needs2Factor: needs2Factor} as profile CALL { with u CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization{delpending:false}),(a)-[:APPOINTED_AS]->(r:Role) return o, r UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization{delpending:false}) return o, {name: ?, listed: true, displayName: ?} as r UNION // TODO: temporary, until a TildaScale landing page lists a delegate's engagements. // Delegated roles are listed:false, so the display name is forced here. WITH u MATCH (u)<-[:FOR_USER]-(da:Actor{delpending:false})<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study{delpending:false})-[:STUDY_TO_ORG]->(o:Organization{delpending:false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor{delpending:false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization{alias:?}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND ? IN apoc.text.split(coalesce(dr.tags, ?), ?) return o, {name: dr.name, listed: true, displayName: dr.displayName} as r } WITH u, o, apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles WHERE roles <> ? OR EXISTS { MATCH (u)-[:FOR_USER]-(:Actor{delpending:false,orgId:o.tildaid})-[:STUDY_TO_ACTOR]-(:Study{delpending:false}) } RETURN collect({orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, orgType: o.orgType, status: o.status, role: roles, displayRoles: displayRoles, logoDocumentId: o.logoDocumentId, theme: o.theme, logoURL: o.logoURL, pinCheckEnabled: o.pinCheckEnabled, requireMFA: o.requireMFA}) AS organizations } return profile{.*, organizations: organizations}
onboardingsvc
1
1.10 s
1.95 s
1.10 s
flat
MATCH (pv:ParticipantVisit) WHERE (pv.edcStatus IS NULL OR pv.edcStatus = ? OR pv.edcStatus = ? OR pv.edcStatus = ?) AND (pv.status = ? OR pv.status = ?) AND pv.deltimestamp = ? MATCH (cp:CarePlan {tildaid: pv.carePlanId})-[:EXECUTE_SOA]- …
MATCH (pv:ParticipantVisit) WHERE (pv.edcStatus IS NULL OR pv.edcStatus = ? OR pv.edcStatus = ? OR pv.edcStatus = ?) AND (pv.status = ? OR pv.status = ?) AND pv.deltimestamp = ? MATCH (cp:CarePlan {tildaid: pv.carePlanId})-[:EXECUTE_SOA]- (soa:ScheduleOfActivities)-[:SOA_TO_PLAN_DEFINITION]- (pd:DslPlanDefinition) MATCH (pd)-[:PLAN_DEFINITION_TO_STUDY]-(st:Study) MATCH (pd)-[:PLAN_DEFINITION_TO_SITE]-(site:Site)-[:SITE_TO_SMO]- (smo)-[:IS_AN_ORG]-(org:Organization) OPTIONAL MATCH (visit:VisitV2)-[:BELONGS_TO_VISIT]-(pv) WITH pv, cp, st, site, org, visit OPTIONAL MATCH (pv)-[:PARTICIPANT_ACTIVITY]->(emptyPa:ParticipantActivity) WHERE (emptyPa.edcStatus IS NULL OR emptyPa.edcStatus = ?) AND emptyPa.deltimestamp = ? WITH pv, cp, st, site, org, visit, collect(emptyPa) AS emptyPas OPTIONAL MATCH (pv)-[:PARTICIPANT_ACTIVITY]->(pa:ParticipantActivity)-[:BELONGS_TO_ACTIVITY]->(act:ActivityV2) WHERE pa.deltimestamp = ? RETURN pv, cp, st, site, org, visit, emptyPas, collect({pa: pa, activity: act}) AS paActPairs LIMIT ?
execsvc
1
1.13 s
1.95 s
1.13 s
flat
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL { WITH u, o, c // scope=OrganizationSMO policies=lead-edit,lead-read MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)…
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL { WITH u, o, c // scope=OrganizationSMO policies=lead-edit,lead-read MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORGANIZATION_TO_ACTOR]->(a) WHERE a.state <> ? AND a.delpending = false AND x.name IN $lists.roles_0 WITH * WHERE o.orgType = ? MATCH (o)-[:ORGANIZATION_TO_LEAD]->(l:Lead {tildaid:c.id}) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient UNION WITH u, o, c // scope=Study policies=study-lead-edit MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role) WHERE a.state <> ? AND a.delpending = false AND o.tildaid = a.orgId AND x.name IN $lists.roles_1 WITH DISTINCT u, o, a, c MATCH (a)<-[:STUDY_TO_ACTOR]-(st:Study) WHERE EXISTS { (st)-[:STUDY_TO_ORG]->(o) } AND ( size(c.studyIds) = ? OR st.tildaid IN c.studyIds ) MATCH (st)<-[:LEAD_TO_STUDY]-(l:Lead {tildaid:c.id}) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, st AS Study, null AS Site, null AS Patient UNION WITH u, o, c // scope=Study policies=study-lead-edit MATCH (u)<-[:FOR_USER]-(da:Actor)<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study)-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(x:Role)<-[:APPOINTED_AS]-(sa:Actor), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias:$tildaScaleAlias}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND da.delpending = false AND sa.state <> ? AND sa.delpending = false AND x.name IN $lists.roles_2 AND ? IN apoc.text.split(coalesce(x.tags, ?), ?) AND ( size(c.studyIds) = ? OR st.tildaid IN c.studyIds ) MATCH (st)<-[:LEAD_TO_STUDY]-(l:Lead {tildaid:c.id}) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, st AS Study, null AS Site, null AS Patient } RETURN checkIdx, User, Organization, Study, Site, Patient
patientsvc
1
1.53 s
1.95 s
1.53 s
flat
MATCH (p:Policy)-[:IS_ASSIGNED_TO]->(r:Role) WHERE coalesce(p.state, ?) IN [?, ?] OPTIONAL MATCH (r)<-[:MIMICS]-(m:Role) OPTIONAL MATCH (p)-[:APPLICABLE_IN]->(s:Scope {version:$scopeVersion}) UNWIND [r.name, m.name] as roleName WITH p, s, …
MATCH (p:Policy)-[:IS_ASSIGNED_TO]->(r:Role) WHERE coalesce(p.state, ?) IN [?, ?] OPTIONAL MATCH (r)<-[:MIMICS]-(m:Role) OPTIONAL MATCH (p)-[:APPLICABLE_IN]->(s:Scope {version:$scopeVersion}) UNWIND [r.name, m.name] as roleName WITH p, s, apoc.text.join(collect(DISTINCT roleName), ?) as roleList RETURN { name: p.name, roleList: roleList, objectTypeList: p.objectTypeList, allowedOps: p.allowedOps, scope: s.name } as policy
exportsvc
1
1.30 s
1.95 s
1.30 s
flat
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Study policies=work-order-edit MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role) WHERE a.state <> ? AN…
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Study policies=work-order-edit MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role) WHERE a.state <> ? AND a.delpending = false AND o.tildaid = a.orgId AND x.name IN $lists.roles_0 WITH DISTINCT u, o, a, c MATCH (a)<-[:STUDY_TO_ACTOR]-(st:Study) WHERE EXISTS { (st)-[:STUDY_TO_ORG]->(o) } AND ( size(c.studyIds) = ? OR st.tildaid IN c.studyIds ) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, st AS Study, null AS Site, null AS Patient UNION // scope=Study policies=work-order-edit MATCH (u)<-[:FOR_USER]-(da:Actor)<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study)-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(x:Role)<-[:APPOINTED_AS]-(sa:Actor), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias:?}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND da.delpending = false AND sa.state <> ? AND sa.delpending = false AND x.name IN $lists.roles_1 AND ? IN apoc.text.split(coalesce(x.tags, ?), ?) AND ( size(c.studyIds) = ? OR st.tildaid IN c.studyIds ) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, st AS Study, null AS Site, null AS Patient } RETURN checkIdx, User, Organization, Study, Site, Patient
virtual-assistant
3
427 ms
1.85 s
1.28 s
flat
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL { WITH u, o, c // scope=Organization policies=org-resources MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORGANI…
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL { WITH u, o, c // scope=Organization policies=org-resources MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORGANIZATION_TO_ACTOR]->(a) WHERE a.state <> ? AND a.delpending = false AND x.name IN $lists.roles_0 MATCH (o)-[:ORGANIZATION_TO_PATIENT]->(p2:Patient {tildaid:c.id}) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient UNION WITH u, o, c // scope=Organization policies=org-resources MATCH (u)<-[:FOR_USER]-(da:Actor)<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study)-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(x:Role)<-[:APPOINTED_AS]-(sa:Actor), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias:$tildaScaleAlias}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND da.delpending = false AND sa.state <> ? AND sa.delpending = false AND x.name IN $lists.roles_1 AND ? IN apoc.text.split(coalesce(x.tags, ?), ?) MATCH (o)-[:ORGANIZATION_TO_PATIENT]->(p2:Patient {tildaid:c.id}) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient } RETURN checkIdx, User, Organization, Study, Site, Patient
patientsvc
3
447 ms
1.85 s
1.34 s
flat
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Study policies=work-order-edit MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role) WHERE a.state <> ? AN…
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Study policies=work-order-edit MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role) WHERE a.state <> ? AND a.delpending = false AND o.tildaid = a.orgId AND x.name IN $lists.roles_0 WITH DISTINCT u, o, a, c MATCH (a)<-[:STUDY_TO_ACTOR]-(st:Study) WHERE EXISTS { (st)-[:STUDY_TO_ORG]->(o) } AND ( size(c.studyIds) = ? OR st.tildaid IN c.studyIds ) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, st AS Study, null AS Site, null AS Patient UNION // scope=Study policies=work-order-edit MATCH (u)<-[:FOR_USER]-(da:Actor)<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study)-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(x:Role)<-[:APPOINTED_AS]-(sa:Actor), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias:?}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND da.delpending = false AND sa.state <> ? AND sa.delpending = false AND x.name IN $lists.roles_1 AND ? IN apoc.text.split(coalesce(x.tags, ?), ?) AND ( size(c.studyIds) = ? OR st.tildaid IN c.studyIds ) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, st AS Study, null AS Site, null AS Patient } RETURN checkIdx, User, Organization, Study, Site, Patient
feedsvc
4
260 ms
1.80 s
1.03 s
flat
MATCH (ph: Document {tildaid: $id}) MATCH (e: Event) - [:PART_OF_EVENT] - (es: EventScope) - [:APPLICABLE_TO] - (del: Deliverable) - [:TRACKS_PLACEHOLDER] - (ph) MATCH (ph) - [:SCOPED_TO] - (es) OPTIONAL MATCH (ph)-[:ACCEPTED_DOCUMENT]->(a…
MATCH (ph: Document {tildaid: $id}) MATCH (e: Event) - [:PART_OF_EVENT] - (es: EventScope) - [:APPLICABLE_TO] - (del: Deliverable) - [:TRACKS_PLACEHOLDER] - (ph) MATCH (ph) - [:SCOPED_TO] - (es) OPTIONAL MATCH (ph)-[:ACCEPTED_DOCUMENT]->(acceptedDoc:Document) WITH ph, e, es, del, acceptedDoc, coalesce(acceptedDoc, ph) AS d OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) OPTIONAL MATCH (siteFromEvent: Site{tildaid: es.scopeId}) WHERE es.scopeType = ? OPTIONAL MATCH (d)-[:DOC_TO_ORG]->(o:Organization) OPTIONAL MATCH (d)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(da:DocAttribute) where da.key in [?, ?, ?, ?] OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (uploader: User) OPTIONAL MATCH (study) - [:STUDY_TO_ACTOR] - (actor: Actor{userId: uploader.tildaid}) WITH d, e, es, del, b, study, b2, coalesce(site, siteFromEvent) AS site, o, head(collect(da)) as da, currentFolder, currentSubArtifact, stagingInfo, artifact, section, zone, collection, subArtifact, uploader, ph, acceptedDoc, head(collect(actor)) as actor CALL apoc.create.vNode([?], { tildaid: ph.tildaid, createdat: ph.createdat, updatedat: ph.updatedat, documentId: acceptedDoc.tildaid, documentCreatedAt: acceptedDoc.createdat, documentUpdatedAt: acceptedDoc.updatedat, orgName: o.name, orgId: o.tildaid, orgAlias: o.alias, studyName: study.name, studyId: study.tildaid, siteName: site.name, siteId: site.tildaid, documentStatus: d.status, country: CASE WHEN es.scopeType = ? THEN coalesce(es.scopeId, d.country) ELSE d.country END, languages: coalesce(apoc.convert.toJson(d.languages), ?), fileName: d.fileName, uploadedByName: uploader.name, uploadedById: uploader.tildaid, collection: d.collection, stateTag: d.stateTag, documentExpiryDate: da.value, zone: zone.name, zoneId: zone.tildaid, zoneNumber: case when zone.number is null then null else apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) end, section: section.name, sectionId: section.tildaid, sectionNumber: case when section.number is null then null else apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) end, artifact: artifact.name, artifactId: artifact.tildaid, artifactNumber: case when artifact.number is null then null else apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?) end, subArtifact: subArtifact.name, subArtifactId: subArtifact.tildaid, subArtifactNumber: case when subArtifact.number is null then null else apoc.text.lpad(toString(COALESCE(subArtifact.number, ?)), ?, ?) end, eventId: e.tildaid, eventCreatedAt: e.createdat, eventType: e.type, eventName: e.name, eventStatus: e.status, eventScopeId: es.tildaid, eventScopeName: es.name, scopeType: es.scopeType, eventScopeDecision: es.decision, deliverableId: del.tildaid, deliverableName: del.name, deliverableLocationId: del.locationId, deliverableLocationType: del.locationType, deliverableType: del.type, roles: actor.roles }) YIELD node return node
writedashrsvc
13
629 ms
1.67 s
1.18 s
flat
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL { WITH u, o, c // scope=Organization policies=org-resources MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORGANI…
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL { WITH u, o, c // scope=Organization policies=org-resources MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORGANIZATION_TO_ACTOR]->(a) WHERE a.state <> ? AND a.delpending = false AND x.name IN $lists.roles_0 MATCH (o)-[:ORGANIZATION_TO_PATIENT]->(p2:Patient {tildaid:c.id}) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient UNION WITH u, o, c // scope=Organization policies=org-resources MATCH (u)<-[:FOR_USER]-(da:Actor)<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study)-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(x:Role)<-[:APPOINTED_AS]-(sa:Actor), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias:$tildaScaleAlias}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND da.delpending = false AND sa.state <> ? AND sa.delpending = false AND x.name IN $lists.roles_1 AND ? IN apoc.text.split(coalesce(x.tags, ?), ?) MATCH (o)-[:ORGANIZATION_TO_PATIENT]->(p2:Patient {tildaid:c.id}) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient } RETURN checkIdx, User, Organization, Study, Site, Patient
patientsvc
7
146 ms
1.65 s
1.01 s
flat
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Study policies=study-document-edit MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role) WHERE a.state <> …
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Study policies=study-document-edit MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role) WHERE a.state <> ? AND a.delpending = false AND o.tildaid = a.orgId AND x.name IN $lists.roles_0 WITH DISTINCT u, o, a, c MATCH (a)<-[:STUDY_TO_ACTOR]-(st:Study) WHERE EXISTS { (st)-[:STUDY_TO_ORG]->(o) } AND ( size(c.studyIds) = ? OR st.tildaid IN c.studyIds ) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, st AS Study, null AS Site, null AS Patient UNION // scope=Study policies=study-document-edit MATCH (u)<-[:FOR_USER]-(da:Actor)<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study)-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(x:Role)<-[:APPOINTED_AS]-(sa:Actor), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias:?}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND da.delpending = false AND sa.state <> ? AND sa.delpending = false AND x.name IN $lists.roles_1 AND ? IN apoc.text.split(coalesce(x.tags, ?), ?) AND ( size(c.studyIds) = ? OR st.tildaid IN c.studyIds ) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, st AS Study, null AS Site, null AS Patient } RETURN checkIdx, User, Organization, Study, Site, Patient
feedsvc
7
240 ms
1.65 s
1.66 s
flat
MATCH (ph: Document {tildaid: $id}) MATCH (e: Event) - [:PART_OF_EVENT] - (es: EventScope) - [:APPLICABLE_TO] - (del: Deliverable) - [:TRACKS_PLACEHOLDER] - (ph) MATCH (ph) - [:SCOPED_TO] - (es) OPTIONAL MATCH (ph)-[:ACCEPTED_DOCUMENT]->(a…
MATCH (ph: Document {tildaid: $id}) MATCH (e: Event) - [:PART_OF_EVENT] - (es: EventScope) - [:APPLICABLE_TO] - (del: Deliverable) - [:TRACKS_PLACEHOLDER] - (ph) MATCH (ph) - [:SCOPED_TO] - (es) OPTIONAL MATCH (ph)-[:ACCEPTED_DOCUMENT]->(acceptedDoc:Document) WITH ph, e, es, del, acceptedDoc, coalesce(acceptedDoc, ph) AS d OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) OPTIONAL MATCH (siteFromEvent: Site{tildaid: es.scopeId}) WHERE es.scopeType = ? OPTIONAL MATCH (d)-[:DOC_TO_ORG]->(o:Organization) OPTIONAL MATCH (d)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(da:DocAttribute) where da.key in [?, ?, ?, ?] OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (uploader: User) OPTIONAL MATCH (study) - [:STUDY_TO_ACTOR] - (actor: Actor{userId: uploader.tildaid}) WITH d, e, es, del, b, study, b2, coalesce(site, siteFromEvent) AS site, o, head(collect(da)) as da, currentFolder, currentSubArtifact, stagingInfo, artifact, section, zone, collection, subArtifact, uploader, ph, acceptedDoc, head(collect(actor)) as actor CALL apoc.create.vNode([?], { tildaid: ph.tildaid, createdat: ph.createdat, updatedat: ph.updatedat, documentId: acceptedDoc.tildaid, documentCreatedAt: acceptedDoc.createdat, documentUpdatedAt: acceptedDoc.updatedat, orgName: o.name, orgId: o.tildaid, orgAlias: o.alias, studyName: study.name, studyId: study.tildaid, siteName: site.name, siteId: site.tildaid, documentStatus: d.status, country: CASE WHEN es.scopeType = ? THEN coalesce(es.scopeId, d.country) ELSE d.country END, languages: coalesce(apoc.convert.toJson(d.languages), ?), fileName: d.fileName, uploadedByName: uploader.name, uploadedById: uploader.tildaid, collection: d.collection, stateTag: d.stateTag, documentExpiryDate: da.value, zone: zone.name, zoneId: zone.tildaid, zoneNumber: case when zone.number is null then null else apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) end, section: section.name, sectionId: section.tildaid, sectionNumber: case when section.number is null then null else apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) end, artifact: artifact.name, artifactId: artifact.tildaid, artifactNumber: case when artifact.number is null then null else apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?) end, subArtifact: subArtifact.name, subArtifactId: subArtifact.tildaid, subArtifactNumber: case when subArtifact.number is null then null else apoc.text.lpad(toString(COALESCE(subArtifact.number, ?)), ?, ?) end, eventId: e.tildaid, eventCreatedAt: e.createdat, eventType: e.type, eventName: e.name, eventStatus: e.status, eventScopeId: es.tildaid, eventScopeName: es.name, scopeType: es.scopeType, eventScopeDecision: es.decision, deliverableId: del.tildaid, deliverableName: del.name, deliverableLocationId: del.locationId, deliverableLocationType: del.locationType, deliverableType: del.type, roles: actor.roles }) YIELD node return node
writedashrsvc
31
262 ms
1.61 s
1.33 s
flat
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Study policies=study-document-edit MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role) WHERE a.state <> …
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Study policies=study-document-edit MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role) WHERE a.state <> ? AND a.delpending = false AND o.tildaid = a.orgId AND x.name IN $lists.roles_0 WITH DISTINCT u, o, a, c MATCH (a)<-[:STUDY_TO_ACTOR]-(st:Study) WHERE EXISTS { (st)-[:STUDY_TO_ORG]->(o) } AND ( size(c.studyIds) = ? OR st.tildaid IN c.studyIds ) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, st AS Study, null AS Site, null AS Patient UNION // scope=Study policies=study-document-edit MATCH (u)<-[:FOR_USER]-(da:Actor)<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study)-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(x:Role)<-[:APPOINTED_AS]-(sa:Actor), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias:?}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND da.delpending = false AND sa.state <> ? AND sa.delpending = false AND x.name IN $lists.roles_1 AND ? IN apoc.text.split(coalesce(x.tags, ?), ?) AND ( size(c.studyIds) = ? OR st.tildaid IN c.studyIds ) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, st AS Study, null AS Site, null AS Patient } RETURN checkIdx, User, Organization, Study, Site, Patient
feedsvc
8
134 ms
1.60 s
1.06 s
flat
MATCH (dv:DocumentVersion {tildaid: $id})<-[:DOCUMENT_VERSION]-(d:Document) MATCH (r:Recommendation) WHERE r.doc_id = d.tildaid AND NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO…
MATCH (dv:DocumentVersion {tildaid: $id})<-[:DOCUMENT_VERSION]-(d:Document) MATCH (r:Recommendation) WHERE r.doc_id = d.tildaid AND NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO_ORGANIZATION]->(o:Organization) OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (u: User) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) CALL { WITH d, site OPTIONAL MATCH (study:Study{tildaid: d.studyId})<-[:PLAN_DEFINITION_TO_STUDY]- (pd:DslPlanDefinition{delpending:false, type:?})-[:PLAN_DEFINITION_TO_SITE]->(site) RETURN COALESCE(pd.siteNumber, ?) AS siteNumber } CALL { WITH dv OPTIONAL MATCH (dv)<-[:DOCUMENT_SOURCE_TO_VERSION]-(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(docAttr: DocAttribute) WITH collect([coalesce(docAttr.key, ?), coalesce(docAttr.value, ?)]) AS attributePairs WITH apoc.map.fromPairs(attributePairs) AS attributesMap With apoc.convert.toJson(attributesMap) AS attributesJson RETURN attributesJson } WITH r, ai, o, d, dv, zone, section, artifact, subArtifact, u, study, site, siteNumber, attributesJson, // Document Scope key stripping: reduce the rec JSON envelope to the keys // valid for its OWN scope so irrelevant keys (e.g. country on a site rec) // don?scope?country?scope?siteName?siteId?siteNumber?scope?scope???{}?{}?????{}?{?{?{????DRecommendation?t emit irrelevant rows (e.g. country on a site-scoped rec). recommendedValue: CASE WHEN r.category = ? AND recAllowed IS NOT NULL THEN apoc.convert.toJson(apoc.map.fromPairs([k IN keys(recMap) WHERE k IN recAllowed | [k, recMap[k]]])) ELSE coalesce(CASE WHEN coalesce(r.data_formatted, ?) <> ? THEN r.data_formatted END, r.data, ?) END, // originalRecommendation = the AI?Document Scope????Document Metadata?{}??Document Scope???Document Naming??TMF Artifact???.???.??? ??Sub Artifact??Document Scope??country???site?????Document Metadata??Document Metadata?????{}??????{}??{}??Document Scope?????country???site??????Document Naming???????TMF Artifact????????.???.??? ??Sub Artifact???????Document Format?Document Summary?Quality Control?PHI Issues?Confirm?Fix It????' } ) YIELD node RETURN node
writedashrsvc
9
223 ms
1.55 s
1.81 s
flat
MATCH (o:Organization {tildaid: $org_id})<-[:WORK_ORDER_CONFIG_TO_ORGANIZATION]-(b:WorkOrderConfig) WHERE b.delpending = false AND (b.study_id IN $lists.accessible_study_ids OR coalesce(b.study_id, ?) = ?) AND b.status <> ? OPTIONAL MATCH …
MATCH (o:Organization {tildaid: $org_id})<-[:WORK_ORDER_CONFIG_TO_ORGANIZATION]-(b:WorkOrderConfig) WHERE b.delpending = false AND (b.study_id IN $lists.accessible_study_ids OR coalesce(b.study_id, ?) = ?) AND b.status <> ? OPTIONAL MATCH (b)-[:WORK_ORDER_CONFIG_TO_CHILD_WORK_ORDER]->(wc:WorkOrder) WHERE wc.delpending = false AND wc.status <> ? AND wc.status IN $lists.child_statuses WITH b, count(wc) AS _match_count WHERE _match_count > ? OPTIONAL MATCH (b)-[:WORK_ORDER_CONFIG_TO_STUDY]->(study:Study) OPTIONAL MATCH (b)-[:WORK_ORDER_CONFIG_TO_CREATOR]->(creator:User) OPTIONAL MATCH (b)-[:WORK_ORDER_CONFIG_TO_TEMPLATE]->(tmpl:WorkOrderTemplate) WITH b, study, creator, tmpl, b.createdat AS _sort_key ORDER BY (CASE WHEN _sort_key IS NULL THEN ? ELSE ? END) ASC, _sort_key DESC, b.tildaid DESC LIMIT $fetch_limit WITH b, study, creator, tmpl, _sort_key // Resolve WorkPlanInstance id/name for workplan-created configs (wp_object_id set). // Mirrors get_workplan_info_for_work_order_config: cfg.wp_object_id -> milestone item // (by tildaid or cfgMilestoneItemId) -> WorkPlanInstance. Non-workplan configs yield null. OPTIONAL MATCH (wpInstance:WorkPlanInstance)-[:WORKPLAN_INSTANCE_TO_MILESTONE]->(:WorkPlanMilestone) -[:REL_WORKPLAN_INSTANCE_MILESTONE_TO_ITEM]->(wpItem:WorkplanInstanceMilestoneItem) WHERE coalesce(b.wp_object_id, ?) <> ? AND (wpItem.tildaid = b.wp_object_id OR wpItem.cfgMilestoneItemId = b.wp_object_id) WITH b, study, creator, tmpl, _sort_key, head(collect(wpInstance.tildaid)) AS workplan_id, head(collect(wpInstance.name)) AS workplan_name OPTIONAL MATCH (b)-[:WORK_ORDER_CONFIG_TO_CHILD_WORK_ORDER]->(w:WorkOrder) WHERE w.delpending = false AND w.status <> ? AND w.status IN $lists.child_statuses OPTIONAL MATCH (w)-[:WORK_ORDER_TO_STUDY]->(wStudy:Study) OPTIONAL MATCH (w)-[:WORK_ORDER_TO_SITE]->(wSite:Site) OPTIONAL MATCH (w)-[:WORK_ORDER_TO_CREATOR]->(wCreator:User) OPTIONAL MATCH (w)-[:WORK_ORDER_TO_ASSIGNEE]->(wAssignee:User) // Resolve EventScope for Event-type child WOs (null for Standard-type) OPTIONAL MATCH (w)-[:WORK_ORDER_TO_EVENT_SCOPE]->(wES:EventScope) // Look up the Site node only for Site-scoped events; guards against null wES and non-Site scopes. // wES.scopeId is a site tildaid (UUID) for Site scopes, country name for Country, ? for Trial. OPTIONAL MATCH (wES_Site:Site {tildaid: wES.scopeId}) WHERE wES.scopeType = ? OPTIONAL MATCH (wPartner:Partner {tildaid: w.recipient_key}) OPTIONAL MATCH (:Actor {tildaid: w.recipient_key})-[:FOR_USER]->(wMember:User) OPTIONAL MATCH (w)-[:WORK_ORDER_TO_TASK]->(wTask:WorkOrderTask) WITH b, study, creator, tmpl, workplan_id, workplan_name, _sort_key, w, wStudy, wSite, wCreator, wAssignee, wES, wES_Site, wPartner, wMember, sum(CASE WHEN wTask.status = ? THEN ? ELSE ? END) AS w_pending_count, sum(CASE WHEN wTask.status = ? THEN ? ELSE ? END) AS w_resolved_count // ENG-?: order children in the DB so children_limit keeps the first N in // DISPLAY order. collect() below preserves incoming row order. // The PARENT keyset terms MUST lead. This ORDER BY runs in a WITH stage AFTER // the parent ORDER BY/LIMIT, and a later ORDER BY re-sorts the whole row stream // — ordering on the child value alone silently re-ranked the CONFIGS by their // child?s QUERY order, not display order: the backward // reversal happens later in Python. ORDER BY (CASE WHEN _sort_key IS NULL THEN ? ELSE ? END) ASC, _sort_key DESC, b.tildaid DESC, (w.createdat IS NULL), w.createdat DESC, w.tildaid WITH b, study, creator, tmpl, workplan_id, workplan_name, _sort_key, collect(DISTINCT CASE WHEN w IS NOT NULL THEN { tildaid: w.tildaid, work_order_id: w.work_order_id, title: w.title, work_order_type: w.work_order_type, status: w.status, priority: w.priority, creator_id: w.creator_id, assigned_to_id: w.assigned_to_id, site_id: w.site_id, study_id: w.study_id, document_ids: w.document_ids, contact_list: w.contact_list, cc_list: w.cc_list, goal: w.goal, due_date: w.due_date, last_reachout: w.last_reachout, last_response: w.last_response, resolved_at: w.resolved_at, accepted_count: w.accepted_count, pending_count: w_pending_count, resolved_count: w_resolved_count, // Mandatory documents this child WO still expects to accept. Pattern // comprehension (like site_number below) keeps the task→subtask // traversal out of the children collect()/count aggregation. Predicate // MUST stay in sync with WorkOrderRepository._count_expected_documents. expected_documents_count: size([(w)-[:WORK_ORDER_TO_TASK]->(t2:WorkOrderTask)-[:TASK_HAS_SUBTASK]->(s:WorkOrderSubtask) WHERE coalesce(t2.status, ?) <> ? AND coalesce(s.is_optional, false) = false AND coalesce(s.status, ?) <> ? AND (coalesce(s.expects_document, false) = true OR s.expects_document IS NULL OR s.placeholder_id IS NOT NULL OR s.sent_doc_id IS NOT NULL OR s.received_doc_id IS NOT NULL) | s]), createdat: w.createdat, updatedat: w.updatedat, thread_id: w.thread_id, rfc_msgid: w.rfc_msgid, parent_id: w.parent_id, // The child? ?Unknown User? ?Unknown User?site?Site?country?Country?trial?Trial?study?Trial???Organization??partner?Partner??studyteam?Study Team?Site?Site?Country?partner??Partner?studyTeam?? ???? ????Study Team?Non-site?s // `late_reply`: that field is projected only when include_late_reply AND a // child_status filter are both supplied, so reading it here reported False // for every unfiltered list (Codex review, ENG-?). collect(DISTINCT CASE WHEN w IS NOT NULL AND (w.status = ? AND w.last_response IS NOT NULL AND coalesce(w.resolved_at, w.status_updated_at) IS NOT NULL AND w.last_response > coalesce(w.resolved_at, w.status_updated_at) AND w.last_response > coalesce(w.late_reply_ack_at, ?)) THEN true ELSE null END) AS _late_flags // Aggregates are computed over the FULL matching child set, BEFORE the // children_limit slice, so a truncated page still renders a correct parent row // (ENG-?). Without these the client can only derive them from `children`, // which is exactly what stops it asking for fewer. WITH b, study, creator, tmpl, workplan_id, workplan_name, _sort_key, _late_flags, [child IN _children_raw WHERE child IS NOT NULL] AS _children WITH b, study, creator, tmpl, workplan_id, workplan_name, _sort_key, _children, size(_children) AS _child_total, reduce(acc = ?, c IN _children | acc + coalesce(c.pending_count, ?)) AS _agg_pending, reduce(acc = ?, c IN _children | acc + coalesce(c.resolved_count, ?)) AS _agg_resolved, size([f IN _late_flags WHERE f = true]) > ? AS _has_late_reply, (size(_children) > ? AND all(c IN _children WHERE c.status = ?)) AS _all_draft RETURN { tildaid: b.tildaid, work_order_config_id: COALESCE(b.work_order_config_id, substring(b.tildaid, ?, ?)), study_id: b.study_id, title: b.title, email_subject: b.email_subject, instructions: b.instructions, email: b.email, recipients: b.recipients, nonsite_recipients: b.nonsite_recipients, site_recipients: b.site_recipients, event_scope_recipients: b.event_scope_recipients, scope_recipients: b.scope_recipients, tasks: b.tasks, // ENG-?: without this, GET /work-order-configs returns plan_steps: [] // for every config and _raw_plan_steps() is dead code. plan_steps: b.plan_steps, plan_instructions: b.plan_instructions, status: b.status, work_order_config_type: b.work_order_config_type, entity_type: b.entity_type, event_id: b.event_id, progress: b.progress, child_count: b.child_count, sent_count: b.sent_count, pending_count: b.pending_count, child_creation_pending: coalesce(b.child_creation_pending, false), // ENG-?: the client recomputes child_creation_pending from these two // (isChildCreationPending), so an unprojected pair reads as ? // and kills the row spinner and the spawn poll. Both, or neither. activated_at: b.activated_at, children_created_at: b.children_created_at, creator_id: b.creator_id, org_id: b.org_id, document_ids: b.document_ids, context_document_ids: COALESCE(b.context_document_ids, []), reasoning: b.reasoning, reasoning_summary: b.reasoning_summary, warning: b.warning, error: b.error, createdat: b.createdat, updatedat: b.updatedat, studyName: CASE WHEN coalesce(b.study_id, ?) = ? THEN ? ELSE COALESCE(study.name, ?) END, creatorName: COALESCE(creator.firstName + ? + creator.lastName, creator.email, ?), // $children_limit < ? is the ? sentinel: a null upper bound makes // the whole slice null in Cypher, so the unlimited case takes the CASE branch. children: CASE WHEN $children_limit < ? THEN _children ELSE _children[?..$children_limit] END, // ENG-? additive aggregates. Always over the full matching child set. child_total: _child_total, children_pending_count: _agg_pending, children_resolved_count: _agg_resolved, has_late_reply: _has_late_reply, all_children_draft: _all_draft, template_id: tmpl.tildaid, template_title: tmpl.title, workplan_id: workplan_id, workplan_name: workplan_name } as work_order_config_with_children, _sort_key // Re-assert the parent order AFTER the child aggregation. The child ORDER BY // above leads with these same terms, but group emission order out of an // aggregation is not guaranteed by Cypher — and the Python loop trims the // lookahead by position, so a re-ordered stream drops the WRONG config and // builds cursors from the wrong boundary. Query order, not display order: // the backward reversal happens later in Python. ORDER BY (CASE WHEN _sort_key IS NULL THEN ? ELSE ? END) ASC, _sort_key DESC, b.tildaid DESC
writevirtual-assistant
9
114 ms
1.55 s
1.02 s
flat
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL { WITH u, o, c // scope=OrganizationSMO policies=lead-edit MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORGANIZ…
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL { WITH u, o, c // scope=OrganizationSMO policies=lead-edit MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORGANIZATION_TO_ACTOR]->(a) WHERE a.state <> ? AND a.delpending = false AND x.name IN $lists.roles_0 WITH * WHERE o.orgType = ? MATCH (o)-[:ORGANIZATION_TO_LEAD]->(l:Lead {tildaid:c.id}) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient UNION WITH u, o, c // scope=Study policies=study-lead-edit MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role) WHERE a.state <> ? AND a.delpending = false AND o.tildaid = a.orgId AND x.name IN $lists.roles_1 WITH DISTINCT u, o, a, c MATCH (a)<-[:STUDY_TO_ACTOR]-(st:Study) WHERE EXISTS { (st)-[:STUDY_TO_ORG]->(o) } AND ( size(c.studyIds) = ? OR st.tildaid IN c.studyIds ) MATCH (st)<-[:LEAD_TO_STUDY]-(l:Lead {tildaid:c.id}) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, st AS Study, null AS Site, null AS Patient UNION WITH u, o, c // scope=Study policies=study-lead-edit MATCH (u)<-[:FOR_USER]-(da:Actor)<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study)-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(x:Role)<-[:APPOINTED_AS]-(sa:Actor), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias:$tildaScaleAlias}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND da.delpending = false AND sa.state <> ? AND sa.delpending = false AND x.name IN $lists.roles_2 AND ? IN apoc.text.split(coalesce(x.tags, ?), ?) AND ( size(c.studyIds) = ? OR st.tildaid IN c.studyIds ) MATCH (st)<-[:LEAD_TO_STUDY]-(l:Lead {tildaid:c.id}) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, st AS Study, null AS Site, null AS Patient } RETURN checkIdx, User, Organization, Study, Site, Patient
patientsvc
9
167 ms
1.55 s
1.48 s
flat
match(q:Query {tildaid: $id}) match(c:CarePlan) where c.tildaid=q.careplanId match(soa:ScheduleOfActivities) where soa.tildaid=c.soaId match(pd:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(site:Site) where pd.tildaid=soa.planDefinitionId…
match(q:Query {tildaid: $id}) match(c:CarePlan) where c.tildaid=q.careplanId match(soa:ScheduleOfActivities) where soa.tildaid=c.soaId match(pd:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(site:Site) where pd.tildaid=soa.planDefinitionId match(study:Study) where study.tildaid=pd.studyId match(org:Organization) where org.tildaid=study.srcorgid OPTIONAL MATCH (pq:ParticipantQuestion {tildaid: q.scopeId})-[:PARTICIPANT_QUESTION]-(pqnr:ParticipantQuestionnaire)-[:PARTICIPANT_QUESTIONNAIRE]-(pa:ParticipantActivity)-[:BELONGS_TO_ACTIVITY]->(a:Activity|ActivityV2) OPTIONAL MATCH (fpa:ParticipantActivity {tildaid: q.scopeId})-[:BELONGS_TO_ACTIVITY]->(fa:Activity|ActivityV2) WHERE q.context = ? OPTIONAL MATCH (:ParticipantQuestionnaire {tildaid: q.scopeId})-[:PARTICIPANT_QUESTIONNAIRE]-(spa:ParticipantActivity)-[:BELONGS_TO_ACTIVITY]->(sa:Activity|ActivityV2) WHERE q.context = ? CALL apoc.create.vNode([?], { newState: q.state, careplanId: q.careplanId, studyId:study.tildaid, studyName: study.name, orgId: org.tildaid, orgName: org.name, orgAlias: org.alias, siteName: site.name, siteLocation: site.state, siteNumber: pd.siteNumber, createdat: q.createdat, updatedat: q.updatedat, firstResponse: q.firstResponse, queryType: q.queryType, activityId: coalesce(a.tildaid, fa.tildaid, sa.tildaid), activityName: coalesce(a.title, fa.title, sa.title), participantActivityId: coalesce(pa.tildaid, fpa.tildaid, spa.tildaid) } ) YIELD node return node
writedashrsvc
9
125 ms
1.55 s
1.10 s
flat
MATCH (d:Document {tildaid: $id}) MATCH (r:Recommendation)-[:RECOMMENDATION_TO_DOCUMENT]->(d) WHERE NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO_ORGANIZATION]->(o:Organization)…
MATCH (d:Document {tildaid: $id}) MATCH (r:Recommendation)-[:RECOMMENDATION_TO_DOCUMENT]->(d) WHERE NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO_ORGANIZATION]->(o:Organization) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (u: User) OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) OPTIONAL MATCH (dv:DocumentVersion{tildaid: d.primaryVersionId}) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) CALL { WITH d, site OPTIONAL MATCH (study:Study{tildaid: d.studyId})<-[:PLAN_DEFINITION_TO_STUDY]- (pd:DslPlanDefinition{delpending:false, type:?})-[:PLAN_DEFINITION_TO_SITE]->(site) RETURN COALESCE(pd.siteNumber, ?) AS siteNumber } CALL { WITH dv OPTIONAL MATCH (dv)<-[:DOCUMENT_SOURCE_TO_VERSION]-(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(docAttr: DocAttribute) WITH collect([coalesce(docAttr.key, ?), coalesce(docAttr.value, ?)]) AS attributePairs WITH apoc.map.fromPairs(attributePairs) AS attributesMap WITH apoc.convert.toJson(attributesMap) AS attributesJson RETURN attributesJson } // Latest state-change ChangeLog on the version — gives us the user // who triggered the doc into its current state. Merge both event // types (Staging + StateTag) since the BE treats them as the same // documentState concept (mirrors the Python migration script). CALL { WITH dv OPTIONAL MATCH (dv)-[:ALL_CHANGELOG]-(dvcl:ChangeLog) WHERE dvcl.type IN [?, ?, ?] AND (dvcl.newValue CONTAINS ? OR dvcl.newValue CONTAINS ?) WITH dvcl ORDER BY dvcl.createdat DESC LIMIT ? OPTIONAL MATCH (changer:User {tildaid: dvcl.changedBy}) WHERE dvcl IS NOT NULL RETURN coalesce(dvcl.changedBy, ?) as statePromotedBy, coalesce(changer.name, ?) as statePromotedByName } WITH r, ai, o, d, dv, zone, section, artifact, subArtifact, u, study, site, siteNumber, attributesJson, statePromotedBy, statePromotedByName, // Document Scope key stripping: reduce the rec JSON envelope to the keys // valid for its OWN scope so irrelevant keys (e.g. country on a site rec) // don?scope?country?scope?siteName?siteId?siteNumber?scope?scope???{}?{}?????{}?{?{?{????DRecommendation????s ORIGINAL prediction (orig_data). // Same Document Scope extraction so this column lines up with // recommendedValue / actualValue. originalRecommendation: coalesce(r.orig_data, ?), recommendationCount: CASE r.category WHEN ? THEN size(keys(apoc.map.clean( apoc.convert.fromJsonMap(coalesce(r.data_formatted, ?)), [], [?]))) WHEN ? THEN apoc.coll.max([?, size([k IN keys(recMap) WHERE (recAllowed IS NULL OR k IN recAllowed) AND coalesce(toString(recMap[k]), ?) <> ?])]) ELSE ? END, actualValue: CASE r.category WHEN ? THEN coalesce(d.fileName, ?) WHEN ? THEN apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?) + ? + coalesce(artifact.name, ?) WHEN ? THEN coalesce(subArtifact.name, ?) WHEN ? THEN apoc.convert.toJson( CASE toLower(coalesce(d.tmfLevel, ?)) WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), country: coalesce(d.country, ?)} WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), siteId: coalesce(site.tildaid, ?), siteName: coalesce(site.name, ?), siteNumber: siteNumber} ELSE {scope: toLower(coalesce(d.tmfLevel, ?))} END) WHEN ? THEN attributesJson ELSE ? END, // accuracyCount: for Document Metadata, the number of keys whose // recommended value matches the actual value (?–N out of // recommendationCount). For all other categories, ? or ? (mirrors // ? or ? for other categories. NULL when not yet actioned. accuracyCount: CASE r.category WHEN ? THEN size([k IN keys(apoc.map.clean(apoc.convert.fromJsonMap(coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?)), [], [?])) WHERE apoc.map.clean(apoc.convert.fromJsonMap(coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?)), [], [?])[k] = apoc.map.clean(apoc.convert.fromJsonMap(coalesce(attributesJson, ?)), [], [?])[k]]) WHEN ? THEN size([k IN keys(cmpMap) WHERE (cmpAllowed IS NULL OR k IN cmpAllowed) AND coalesce(toString(cmpMap[k]), ?) <> ? AND toLower(coalesce(toString(cmpMap[k]), ?)) = toLower(coalesce(toString((CASE toLower(coalesce(d.tmfLevel, ?)) WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), country: coalesce(d.country, ?)} WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), siteId: coalesce(site.tildaid, ?), siteName: coalesce(site.name, ?), siteNumber: siteNumber} ELSE {scope: toLower(coalesce(d.tmfLevel, ?))} END)[k]), ?))]) ELSE CASE (CASE r.category WHEN ? THEN coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?) = coalesce(d.fileName, ?) WHEN ? THEN coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?) = ( apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?) + ? + coalesce(artifact.name, ?)) WHEN ? THEN coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?) = coalesce(subArtifact.name, ?) ELSE CASE WHEN r.category IN [?, ?, ?, ?] THEN r.user_action = ? OR (r.user_action = ? AND coalesce(r.comment, ?) = ?) END END) WHEN true THEN ? WHEN false THEN ? ELSE null END END, comment: r.comment, statePromotedBy: statePromotedBy, statePromotedByName: statePromotedByName } ) YIELD node RETURN node
writedashrsvc
10
216 ms
1.50 s
1.98 s
flat
MATCH (currentUser:User {deltimestamp:?}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true) AND currentUser.email = $ident OPTIONAL MATCH (supportUser:User {email:$supportEmail}) OPTIONAL MATCH (targetOrg:Organization {del…
MATCH (currentUser:User {deltimestamp:?}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true) AND currentUser.email = $ident OPTIONAL MATCH (supportUser:User {email:$supportEmail}) OPTIONAL MATCH (targetOrg:Organization {delpending:false, alias:$org}) OPTIONAL MATCH (currentUser)-[:FOR_USER]-(orgActor:Actor{delpending:false})-[:ORGANIZATION_TO_ACTOR]-(targetOrg) WHERE coalesce(orgActor.state, ?) <> ? OPTIONAL MATCH (currentUser)-[supports:SUPPORTS_ORG]-(targetOrg) WITH *, false AS repOf WITH *, CASE WHEN orgActor IS NULL THEN EXISTS { MATCH (currentUser)<-[:FOR_USER]-(da:Actor{delpending:false})<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study{delpending:false})-[:STUDY_TO_ORG]->(targetOrg), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor{delpending:false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization{alias:$scaleAlias}) WHERE st.srcorgid = targetOrg.tildaid AND da.state <> ? AND sa.state <> ? AND $delegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) } ELSE false END as delegated RETURN CASE WHEN orgActor is not null THEN currentUser WHEN delegated THEN currentUser WHEN repOf THEN currentUser WHEN supports is not null THEN coalesce(supportUser, currentUser) ELSE currentUser END as user, CASE WHEN orgActor is not null OR delegated OR repOf OR supports is not null THEN targetOrg ELSE null END as org, currentUser as tokenUser
virtual-assistant
10
105 ms
1.50 s
1.04 s
flat
match(q:Query {tildaid: $id}) match(c:CarePlan) where c.tildaid=q.careplanId match(soa:ScheduleOfActivities) where soa.tildaid=c.soaId match(pd:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(site:Site) where pd.tildaid=soa.planDefinitionId…
match(q:Query {tildaid: $id}) match(c:CarePlan) where c.tildaid=q.careplanId match(soa:ScheduleOfActivities) where soa.tildaid=c.soaId match(pd:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(site:Site) where pd.tildaid=soa.planDefinitionId match(study:Study) where study.tildaid=pd.studyId match(org:Organization) where org.tildaid=study.srcorgid OPTIONAL MATCH (pq:ParticipantQuestion {tildaid: q.scopeId})-[:PARTICIPANT_QUESTION]-(pqnr:ParticipantQuestionnaire)-[:PARTICIPANT_QUESTIONNAIRE]-(pa:ParticipantActivity)-[:BELONGS_TO_ACTIVITY]->(a:Activity|ActivityV2) OPTIONAL MATCH (fpa:ParticipantActivity {tildaid: q.scopeId})-[:BELONGS_TO_ACTIVITY]->(fa:Activity|ActivityV2) WHERE q.context = ? OPTIONAL MATCH (:ParticipantQuestionnaire {tildaid: q.scopeId})-[:PARTICIPANT_QUESTIONNAIRE]-(spa:ParticipantActivity)-[:BELONGS_TO_ACTIVITY]->(sa:Activity|ActivityV2) WHERE q.context = ? CALL apoc.create.vNode([?], { newState: q.state, careplanId: q.careplanId, studyId:study.tildaid, studyName: study.name, orgId: org.tildaid, orgName: org.name, orgAlias: org.alias, siteName: site.name, siteLocation: site.state, siteNumber: pd.siteNumber, createdat: q.createdat, updatedat: q.updatedat, firstResponse: q.firstResponse, queryType: q.queryType, activityId: coalesce(a.tildaid, fa.tildaid, sa.tildaid), activityName: coalesce(a.title, fa.title, sa.title), participantActivityId: coalesce(pa.tildaid, fpa.tildaid, spa.tildaid) } ) YIELD node return node
writedashrsvc
10
202 ms
1.50 s
1.02 s
flat
MATCH (d:Document {tildaid: $id}) MATCH (r:Recommendation)-[:RECOMMENDATION_TO_DOCUMENT]->(d) WHERE NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO_ORGANIZATION]->(o:Organization)…
MATCH (d:Document {tildaid: $id}) MATCH (r:Recommendation)-[:RECOMMENDATION_TO_DOCUMENT]->(d) WHERE NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO_ORGANIZATION]->(o:Organization) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (u: User) OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) OPTIONAL MATCH (dv:DocumentVersion{tildaid: d.primaryVersionId}) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) CALL { WITH d, site OPTIONAL MATCH (study:Study{tildaid: d.studyId})<-[:PLAN_DEFINITION_TO_STUDY]- (pd:DslPlanDefinition{delpending:false, type:?})-[:PLAN_DEFINITION_TO_SITE]->(site) RETURN COALESCE(pd.siteNumber, ?) AS siteNumber } CALL { WITH dv OPTIONAL MATCH (dv)<-[:DOCUMENT_SOURCE_TO_VERSION]-(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(docAttr: DocAttribute) WITH collect([coalesce(docAttr.key, ?), coalesce(docAttr.value, ?)]) AS attributePairs WITH apoc.map.fromPairs(attributePairs) AS attributesMap WITH apoc.convert.toJson(attributesMap) AS attributesJson RETURN attributesJson } // Latest state-change ChangeLog on the version — gives us the user // who triggered the doc into its current state. Merge both event // types (Staging + StateTag) since the BE treats them as the same // documentState concept (mirrors the Python migration script). CALL { WITH dv OPTIONAL MATCH (dv)-[:ALL_CHANGELOG]-(dvcl:ChangeLog) WHERE dvcl.type IN [?, ?, ?] AND (dvcl.newValue CONTAINS ? OR dvcl.newValue CONTAINS ?) WITH dvcl ORDER BY dvcl.createdat DESC LIMIT ? OPTIONAL MATCH (changer:User {tildaid: dvcl.changedBy}) WHERE dvcl IS NOT NULL RETURN coalesce(dvcl.changedBy, ?) as statePromotedBy, coalesce(changer.name, ?) as statePromotedByName } WITH r, ai, o, d, dv, zone, section, artifact, subArtifact, u, study, site, siteNumber, attributesJson, statePromotedBy, statePromotedByName, // Document Scope key stripping: reduce the rec JSON envelope to the keys // valid for its OWN scope so irrelevant keys (e.g. country on a site rec) // don?scope?country?scope?siteName?siteId?siteNumber?scope?scope???{}?{}?????{}?{?{?{????DRecommendation????s ORIGINAL prediction (orig_data). // Same Document Scope extraction so this column lines up with // recommendedValue / actualValue. originalRecommendation: coalesce(r.orig_data, ?), recommendationCount: CASE r.category WHEN ? THEN size(keys(apoc.map.clean( apoc.convert.fromJsonMap(coalesce(r.data_formatted, ?)), [], [?]))) WHEN ? THEN apoc.coll.max([?, size([k IN keys(recMap) WHERE (recAllowed IS NULL OR k IN recAllowed) AND coalesce(toString(recMap[k]), ?) <> ?])]) ELSE ? END, actualValue: CASE r.category WHEN ? THEN coalesce(d.fileName, ?) WHEN ? THEN apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?) + ? + coalesce(artifact.name, ?) WHEN ? THEN coalesce(subArtifact.name, ?) WHEN ? THEN apoc.convert.toJson( CASE toLower(coalesce(d.tmfLevel, ?)) WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), country: coalesce(d.country, ?)} WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), siteId: coalesce(site.tildaid, ?), siteName: coalesce(site.name, ?), siteNumber: siteNumber} ELSE {scope: toLower(coalesce(d.tmfLevel, ?))} END) WHEN ? THEN attributesJson ELSE ? END, // accuracyCount: for Document Metadata, the number of keys whose // recommended value matches the actual value (?–N out of // recommendationCount). For all other categories, ? or ? (mirrors // ? or ? for other categories. NULL when not yet actioned. accuracyCount: CASE r.category WHEN ? THEN size([k IN keys(apoc.map.clean(apoc.convert.fromJsonMap(coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?)), [], [?])) WHERE apoc.map.clean(apoc.convert.fromJsonMap(coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?)), [], [?])[k] = apoc.map.clean(apoc.convert.fromJsonMap(coalesce(attributesJson, ?)), [], [?])[k]]) WHEN ? THEN size([k IN keys(cmpMap) WHERE (cmpAllowed IS NULL OR k IN cmpAllowed) AND coalesce(toString(cmpMap[k]), ?) <> ? AND toLower(coalesce(toString(cmpMap[k]), ?)) = toLower(coalesce(toString((CASE toLower(coalesce(d.tmfLevel, ?)) WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), country: coalesce(d.country, ?)} WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), siteId: coalesce(site.tildaid, ?), siteName: coalesce(site.name, ?), siteNumber: siteNumber} ELSE {scope: toLower(coalesce(d.tmfLevel, ?))} END)[k]), ?))]) ELSE CASE (CASE r.category WHEN ? THEN coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?) = coalesce(d.fileName, ?) WHEN ? THEN coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?) = ( apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?) + ? + coalesce(artifact.name, ?)) WHEN ? THEN coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?) = coalesce(subArtifact.name, ?) ELSE CASE WHEN r.category IN [?, ?, ?, ?] THEN r.user_action = ? OR (r.user_action = ? AND coalesce(r.comment, ?) = ?) END END) WHEN true THEN ? WHEN false THEN ? ELSE null END END, comment: r.comment, statePromotedBy: statePromotedBy, statePromotedByName: statePromotedByName } ) YIELD node RETURN node
writedashrsvc
11
172 ms
1.45 s
1.87 s
flat
MATCH (ph: Document {tildaid: $id}) MATCH (e: Event) - [:PART_OF_EVENT] - (es: EventScope) - [:APPLICABLE_TO] - (del: Deliverable) - [:TRACKS_PLACEHOLDER] - (ph) MATCH (ph) - [:SCOPED_TO] - (es) OPTIONAL MATCH (ph)-[:ACCEPTED_DOCUMENT]->(a…
MATCH (ph: Document {tildaid: $id}) MATCH (e: Event) - [:PART_OF_EVENT] - (es: EventScope) - [:APPLICABLE_TO] - (del: Deliverable) - [:TRACKS_PLACEHOLDER] - (ph) MATCH (ph) - [:SCOPED_TO] - (es) OPTIONAL MATCH (ph)-[:ACCEPTED_DOCUMENT]->(acceptedDoc:Document) WITH ph, e, es, del, acceptedDoc, coalesce(acceptedDoc, ph) AS d OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) OPTIONAL MATCH (siteFromEvent: Site{tildaid: es.scopeId}) WHERE es.scopeType = ? OPTIONAL MATCH (d)-[:DOC_TO_ORG]->(o:Organization) OPTIONAL MATCH (d)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(da:DocAttribute) where da.key in [?, ?, ?, ?] OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (uploader: User) OPTIONAL MATCH (study) - [:STUDY_TO_ACTOR] - (actor: Actor{userId: uploader.tildaid}) WITH d, e, es, del, b, study, b2, coalesce(site, siteFromEvent) AS site, o, head(collect(da)) as da, currentFolder, currentSubArtifact, stagingInfo, artifact, section, zone, collection, subArtifact, uploader, ph, acceptedDoc, head(collect(actor)) as actor CALL apoc.create.vNode([?], { tildaid: ph.tildaid, createdat: ph.createdat, updatedat: ph.updatedat, documentId: acceptedDoc.tildaid, documentCreatedAt: acceptedDoc.createdat, documentUpdatedAt: acceptedDoc.updatedat, orgName: o.name, orgId: o.tildaid, orgAlias: o.alias, studyName: study.name, studyId: study.tildaid, siteName: site.name, siteId: site.tildaid, documentStatus: d.status, country: CASE WHEN es.scopeType = ? THEN coalesce(es.scopeId, d.country) ELSE d.country END, languages: coalesce(apoc.convert.toJson(d.languages), ?), fileName: d.fileName, uploadedByName: uploader.name, uploadedById: uploader.tildaid, collection: d.collection, stateTag: d.stateTag, documentExpiryDate: da.value, zone: zone.name, zoneId: zone.tildaid, zoneNumber: case when zone.number is null then null else apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) end, section: section.name, sectionId: section.tildaid, sectionNumber: case when section.number is null then null else apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) end, artifact: artifact.name, artifactId: artifact.tildaid, artifactNumber: case when artifact.number is null then null else apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?) end, subArtifact: subArtifact.name, subArtifactId: subArtifact.tildaid, subArtifactNumber: case when subArtifact.number is null then null else apoc.text.lpad(toString(COALESCE(subArtifact.number, ?)), ?, ?) end, eventId: e.tildaid, eventCreatedAt: e.createdat, eventType: e.type, eventName: e.name, eventStatus: e.status, eventScopeId: es.tildaid, eventScopeName: es.name, scopeType: es.scopeType, eventScopeDecision: es.decision, deliverableId: del.tildaid, deliverableName: del.name, deliverableLocationId: del.locationId, deliverableLocationType: del.locationType, deliverableType: del.type, roles: actor.roles }) YIELD node return node
writedashrsvc
12
107 ms
1.40 s
1.26 s
flat
// First part for StudySiteUser scope match (:StudySiteDuty)-[:STUDYSITEDUTY_TO_STUDYSITEACTOR]->(scopeUser:StudySiteActor{delpending:false}) with distinct scopeUser match (scopeUser)-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(sitePd:DslPlanDe…
// First part for StudySiteUser scope match (:StudySiteDuty)-[:STUDYSITEDUTY_TO_STUDYSITEACTOR]->(scopeUser:StudySiteActor{delpending:false}) with distinct scopeUser match (scopeUser)-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(sitePd:DslPlanDefinition{type:?}) match (sitePd)-[:PLAN_DEFINITION_TO_ADOPTED_WORKFLOWS]->(w:WorkflowV2)<-[:TRIGGER_TO_WORKFLOW]-(t:Trigger{scope:?}) match (sitePd)-[:PLAN_DEFINITION_TO_STUDY]->(st:Study)-[:STUDY_TO_ORG]->(o:Organization{orgType:?}) match (sitePd)-[:PLAN_DEFINITION_TO_SITE]->(site:Site) match (scopeUser)-[:STUDYSITEACTOR_TO_ACTOR]->(actor:Actor{delpending:false})<-[:STUDY_TO_ACTOR]-(st) where not exists((scopeUser)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:ParticipantWorkflow)) return distinct scopeUser.tildaid as scopeTildaid, t.scope as workflowScope, st.tildaid as stId, o.alias as orgAlias, site.tildaid as siteId, scopeUser.roles as roles UNION // Second part for StudySite scope match (t:Trigger{scope:?})-[:TRIGGER_TO_WORKFLOW]->(w:WorkflowV2) match (w)<-[:PLAN_DEFINITION_TO_ADOPTED_WORKFLOWS]-(scopeSite:DslPlanDefinition{type:?}) where not exists((scopeSite)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:ParticipantWorkflow)) with distinct t.scope as workflowScope, scopeSite match (scopeSite)-[:PLAN_DEFINITION_TO_STUDY]->(st:Study)-[:STUDY_TO_ORG]->(o:Organization{orgType:?}) match (scopeSite)-[:PLAN_DEFINITION_TO_SITE]->(site:Site) return distinct scopeSite.tildaid as scopeTildaid, workflowScope, st.tildaid as stId, o.alias as orgAlias, site.tildaid as siteId, null as roles
regsvc
13
87 ms
1.35 s
1.08 s
flat
MATCH (u:User{tildaid:$user}), (o:Organization{delpending:false, alias:$org}) CALL (u, o) { OPTIONAL MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o), (a)-[:APPOINTED_AS]->(r:Role) WHERE not r.name = ? AND c…
MATCH (u:User{tildaid:$user}), (o:Organization{delpending:false, alias:$org}) CALL (u, o) { OPTIONAL MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o), (a)-[:APPOINTED_AS]->(r:Role) WHERE not r.name = ? AND coalesce(a.state, ?) <> ? return r{.*} UNION MATCH (u)<-[:FOR_USER]-(da:Actor{delpending:false})<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study{delpending:false})-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(r:Role)<-[:APPOINTED_AS]-(sa:Actor{delpending:false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization{alias:?}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND ? IN apoc.text.split(coalesce(r.tags, ?), ?) return distinct r{.*} } WITH u, o, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles, ANY(n IN COLLECT(r.external) WHERE n = true) as external, ANY(n IN COLLECT(r.name) WHERE n = ?) as isPatient, ALL(n IN COLLECT(r.piiAccess) WHERE n = false) as hidePhi WITH u, o, {organization:o{.*}, external: external, isPatient: isPatient, hidePhi: hidePhi, roles: roles, displayRoles: displayRoles } as context CALL (u, o) { MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:STAFF_TO_ACTOR]-(si:Site{delpending:false})-[:SITE_TO_SMO]->(:Smo)-[:IS_AN_ORG]->(o) WHERE coalesce(a.state, ?) <> ? OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, si, a, r order by r.displayName WITH u, o, si, a, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles WITH CASE when not si is null then {siteId: si.tildaid, roles: roles, displayRoles: displayRoles} end as si return collect(si) as sites, apoc.coll.flatten(collect(si.roles)) as siteRoles } CALL (u, o) { CALL (u, o) { MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false, orgId:o.tildaid}) WHERE coalesce(a.state, ?) <> ? // Required pipeline barrier: without it the actor match re-expands // once per study in the org (?.0M -> 32k db hits, measured in Go). WITH DISTINCT u, o, a MATCH (a)<-[:STUDY_TO_ACTOR]-(s:Study{delpending:false})-[:STUDY_TO_ORG]->(o) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) RETURN s, r UNION // Delegated engagement Actors: orgId is TildaScale? roles. WITH s, r order by r.displayName WITH s, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles // Ordered so the studies array is a stable sequence for clients. WITH s, {studyId: s.tildaid, roles: roles, displayRoles: displayRoles, srcOrgId: s.srcorgid} as st ORDER BY s.name, s.tildaid return collect(st) as studies, apoc.coll.flatten(collect(st.roles)) as studyRoles } with distinct context, studies, apoc.coll.toSet(apoc.coll.flatten(collect(studyRoles))) as allStudyRoles, apoc.coll.toSet(apoc.coll.flatten(collect(siteRoles))) as siRoles with context, studies, apoc.coll.toSet(apoc.coll.flatten([context.roles, allStudyRoles, siRoles])) as allRoles return context{.*, studies: studies, allRoles: allRoles} as rc
feedsvc
13
141 ms
1.35 s
1.80 s
flat
MATCH (d:Document {tildaid: $id}) MATCH (r:Recommendation)-[:RECOMMENDATION_TO_DOCUMENT]->(d) WHERE NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO_ORGANIZATION]->(o:Organization)…
MATCH (d:Document {tildaid: $id}) MATCH (r:Recommendation)-[:RECOMMENDATION_TO_DOCUMENT]->(d) WHERE NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO_ORGANIZATION]->(o:Organization) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (u: User) OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) OPTIONAL MATCH (dv:DocumentVersion{tildaid: d.primaryVersionId}) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) CALL { WITH d, site OPTIONAL MATCH (study:Study{tildaid: d.studyId})<-[:PLAN_DEFINITION_TO_STUDY]- (pd:DslPlanDefinition{delpending:false, type:?})-[:PLAN_DEFINITION_TO_SITE]->(site) RETURN COALESCE(pd.siteNumber, ?) AS siteNumber } CALL { WITH dv OPTIONAL MATCH (dv)<-[:DOCUMENT_SOURCE_TO_VERSION]-(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(docAttr: DocAttribute) WITH collect([coalesce(docAttr.key, ?), coalesce(docAttr.value, ?)]) AS attributePairs WITH apoc.map.fromPairs(attributePairs) AS attributesMap WITH apoc.convert.toJson(attributesMap) AS attributesJson RETURN attributesJson } // Latest state-change ChangeLog on the version — gives us the user // who triggered the doc into its current state. Merge both event // types (Staging + StateTag) since the BE treats them as the same // documentState concept (mirrors the Python migration script). CALL { WITH dv OPTIONAL MATCH (dv)-[:ALL_CHANGELOG]-(dvcl:ChangeLog) WHERE dvcl.type IN [?, ?, ?] AND (dvcl.newValue CONTAINS ? OR dvcl.newValue CONTAINS ?) WITH dvcl ORDER BY dvcl.createdat DESC LIMIT ? OPTIONAL MATCH (changer:User {tildaid: dvcl.changedBy}) WHERE dvcl IS NOT NULL RETURN coalesce(dvcl.changedBy, ?) as statePromotedBy, coalesce(changer.name, ?) as statePromotedByName } WITH r, ai, o, d, dv, zone, section, artifact, subArtifact, u, study, site, siteNumber, attributesJson, statePromotedBy, statePromotedByName, // Document Scope key stripping: reduce the rec JSON envelope to the keys // valid for its OWN scope so irrelevant keys (e.g. country on a site rec) // don?scope?country?scope?siteName?siteId?siteNumber?scope?scope???{}?{}?????{}?{?{?{????DRecommendation????s ORIGINAL prediction (orig_data). // Same Document Scope extraction so this column lines up with // recommendedValue / actualValue. originalRecommendation: coalesce(r.orig_data, ?), recommendationCount: CASE r.category WHEN ? THEN size(keys(apoc.map.clean( apoc.convert.fromJsonMap(coalesce(r.data_formatted, ?)), [], [?]))) WHEN ? THEN apoc.coll.max([?, size([k IN keys(recMap) WHERE (recAllowed IS NULL OR k IN recAllowed) AND coalesce(toString(recMap[k]), ?) <> ?])]) ELSE ? END, actualValue: CASE r.category WHEN ? THEN coalesce(d.fileName, ?) WHEN ? THEN apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?) + ? + coalesce(artifact.name, ?) WHEN ? THEN coalesce(subArtifact.name, ?) WHEN ? THEN apoc.convert.toJson( CASE toLower(coalesce(d.tmfLevel, ?)) WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), country: coalesce(d.country, ?)} WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), siteId: coalesce(site.tildaid, ?), siteName: coalesce(site.name, ?), siteNumber: siteNumber} ELSE {scope: toLower(coalesce(d.tmfLevel, ?))} END) WHEN ? THEN attributesJson ELSE ? END, // accuracyCount: for Document Metadata, the number of keys whose // recommended value matches the actual value (?–N out of // recommendationCount). For all other categories, ? or ? (mirrors // ? or ? for other categories. NULL when not yet actioned. accuracyCount: CASE r.category WHEN ? THEN size([k IN keys(apoc.map.clean(apoc.convert.fromJsonMap(coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?)), [], [?])) WHERE apoc.map.clean(apoc.convert.fromJsonMap(coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?)), [], [?])[k] = apoc.map.clean(apoc.convert.fromJsonMap(coalesce(attributesJson, ?)), [], [?])[k]]) WHEN ? THEN size([k IN keys(cmpMap) WHERE (cmpAllowed IS NULL OR k IN cmpAllowed) AND coalesce(toString(cmpMap[k]), ?) <> ? AND toLower(coalesce(toString(cmpMap[k]), ?)) = toLower(coalesce(toString((CASE toLower(coalesce(d.tmfLevel, ?)) WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), country: coalesce(d.country, ?)} WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), siteId: coalesce(site.tildaid, ?), siteName: coalesce(site.name, ?), siteNumber: siteNumber} ELSE {scope: toLower(coalesce(d.tmfLevel, ?))} END)[k]), ?))]) ELSE CASE (CASE r.category WHEN ? THEN coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?) = coalesce(d.fileName, ?) WHEN ? THEN coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?) = ( apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?) + ? + coalesce(artifact.name, ?)) WHEN ? THEN coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?) = coalesce(subArtifact.name, ?) ELSE CASE WHEN r.category IN [?, ?, ?, ?] THEN r.user_action = ? OR (r.user_action = ? AND coalesce(r.comment, ?) = ?) END END) WHEN true THEN ? WHEN false THEN ? ELSE null END END, comment: r.comment, statePromotedBy: statePromotedBy, statePromotedByName: statePromotedByName } ) YIELD node RETURN node
writedashrsvc
14
122 ms
1.30 s
1.69 s
flat
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Organization policies=org-work-order-edit,org-work-order-read MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]-…
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Organization policies=org-work-order-edit,org-work-order-read MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORGANIZATION_TO_ACTOR]->(a) WHERE a.state <> ? AND a.delpending = false AND x.name IN $lists.roles_0 MATCH (wo:WorkOrder {tildaid:c.id}) WHERE wo.org_id = o.tildaid AND coalesce(wo.study_id, ?) = ? RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient UNION // scope=Organization policies=org-work-order-edit,org-work-order-read MATCH (u)<-[:FOR_USER]-(da:Actor)<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study)-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(x:Role)<-[:APPOINTED_AS]-(sa:Actor), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias:?}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND da.delpending = false AND sa.state <> ? AND sa.delpending = false AND x.name IN $lists.roles_1 AND ? IN apoc.text.split(coalesce(x.tags, ?), ?) MATCH (wo:WorkOrder {tildaid:c.id}) WHERE wo.org_id = o.tildaid AND coalesce(wo.study_id, ?) = ? RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient } RETURN checkIdx, User, Organization, Study, Site, Patient
virtual-assistant
18
59 ms
1.10 s
1.02 s
flat
MATCH (ph: Document {tildaid: $id}) MATCH (e: Event) - [:PART_OF_EVENT] - (es: EventScope) - [:APPLICABLE_TO] - (del: Deliverable) - [:TRACKS_PLACEHOLDER] - (ph) MATCH (ph) - [:SCOPED_TO] - (es) OPTIONAL MATCH (ph)-[:ACCEPTED_DOCUMENT]->(a…
MATCH (ph: Document {tildaid: $id}) MATCH (e: Event) - [:PART_OF_EVENT] - (es: EventScope) - [:APPLICABLE_TO] - (del: Deliverable) - [:TRACKS_PLACEHOLDER] - (ph) MATCH (ph) - [:SCOPED_TO] - (es) OPTIONAL MATCH (ph)-[:ACCEPTED_DOCUMENT]->(acceptedDoc:Document) WITH ph, e, es, del, acceptedDoc, coalesce(acceptedDoc, ph) AS d OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) OPTIONAL MATCH (siteFromEvent: Site{tildaid: es.scopeId}) WHERE es.scopeType = ? OPTIONAL MATCH (d)-[:DOC_TO_ORG]->(o:Organization) OPTIONAL MATCH (d)-[:DOCUMENT_TO_SOURCE]->(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(da:DocAttribute) where da.key in [?, ?, ?, ?] OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (uploader: User) OPTIONAL MATCH (study) - [:STUDY_TO_ACTOR] - (actor: Actor{userId: uploader.tildaid}) WITH d, e, es, del, b, study, b2, coalesce(site, siteFromEvent) AS site, o, head(collect(da)) as da, currentFolder, currentSubArtifact, stagingInfo, artifact, section, zone, collection, subArtifact, uploader, ph, acceptedDoc, head(collect(actor)) as actor CALL apoc.create.vNode([?], { tildaid: ph.tildaid, createdat: ph.createdat, updatedat: ph.updatedat, documentId: acceptedDoc.tildaid, documentCreatedAt: acceptedDoc.createdat, documentUpdatedAt: acceptedDoc.updatedat, orgName: o.name, orgId: o.tildaid, orgAlias: o.alias, studyName: study.name, studyId: study.tildaid, siteName: site.name, siteId: site.tildaid, documentStatus: d.status, country: CASE WHEN es.scopeType = ? THEN coalesce(es.scopeId, d.country) ELSE d.country END, languages: coalesce(apoc.convert.toJson(d.languages), ?), fileName: d.fileName, uploadedByName: uploader.name, uploadedById: uploader.tildaid, collection: d.collection, stateTag: d.stateTag, documentExpiryDate: da.value, zone: zone.name, zoneId: zone.tildaid, zoneNumber: case when zone.number is null then null else apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) end, section: section.name, sectionId: section.tildaid, sectionNumber: case when section.number is null then null else apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) end, artifact: artifact.name, artifactId: artifact.tildaid, artifactNumber: case when artifact.number is null then null else apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?) end, subArtifact: subArtifact.name, subArtifactId: subArtifact.tildaid, subArtifactNumber: case when subArtifact.number is null then null else apoc.text.lpad(toString(COALESCE(subArtifact.number, ?)), ?, ?) end, eventId: e.tildaid, eventCreatedAt: e.createdat, eventType: e.type, eventName: e.name, eventStatus: e.status, eventScopeId: es.tildaid, eventScopeName: es.name, scopeType: es.scopeType, eventScopeDecision: es.decision, deliverableId: del.tildaid, deliverableName: del.name, deliverableLocationId: del.locationId, deliverableLocationType: del.locationType, deliverableType: del.type, roles: actor.roles }) YIELD node return node
writedashrsvc
37
315 ms
1.07 s
1.46 s
flat
MATCH (d:Document {tildaid: $id}) MATCH (r:Recommendation)-[:RECOMMENDATION_TO_DOCUMENT]->(d) WHERE NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO_ORGANIZATION]->(o:Organization)…
MATCH (d:Document {tildaid: $id}) MATCH (r:Recommendation)-[:RECOMMENDATION_TO_DOCUMENT]->(d) WHERE NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO_ORGANIZATION]->(o:Organization) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (u: User) OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) OPTIONAL MATCH (dv:DocumentVersion{tildaid: d.primaryVersionId}) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) CALL { WITH d, site OPTIONAL MATCH (study:Study{tildaid: d.studyId})<-[:PLAN_DEFINITION_TO_STUDY]- (pd:DslPlanDefinition{delpending:false, type:?})-[:PLAN_DEFINITION_TO_SITE]->(site) RETURN COALESCE(pd.siteNumber, ?) AS siteNumber } CALL { WITH dv OPTIONAL MATCH (dv)<-[:DOCUMENT_SOURCE_TO_VERSION]-(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(docAttr: DocAttribute) WITH collect([coalesce(docAttr.key, ?), coalesce(docAttr.value, ?)]) AS attributePairs WITH apoc.map.fromPairs(attributePairs) AS attributesMap WITH apoc.convert.toJson(attributesMap) AS attributesJson RETURN attributesJson } // Latest state-change ChangeLog on the version — gives us the user // who triggered the doc into its current state. Merge both event // types (Staging + StateTag) since the BE treats them as the same // documentState concept (mirrors the Python migration script). CALL { WITH dv OPTIONAL MATCH (dv)-[:ALL_CHANGELOG]-(dvcl:ChangeLog) WHERE dvcl.type IN [?, ?, ?] AND (dvcl.newValue CONTAINS ? OR dvcl.newValue CONTAINS ?) WITH dvcl ORDER BY dvcl.createdat DESC LIMIT ? OPTIONAL MATCH (changer:User {tildaid: dvcl.changedBy}) WHERE dvcl IS NOT NULL RETURN coalesce(dvcl.changedBy, ?) as statePromotedBy, coalesce(changer.name, ?) as statePromotedByName } WITH r, ai, o, d, dv, zone, section, artifact, subArtifact, u, study, site, siteNumber, attributesJson, statePromotedBy, statePromotedByName, // Document Scope key stripping: reduce the rec JSON envelope to the keys // valid for its OWN scope so irrelevant keys (e.g. country on a site rec) // don?scope?country?scope?siteName?siteId?siteNumber?scope?scope???{}?{}?????{}?{?{?{????DRecommendation????s ORIGINAL prediction (orig_data). // Same Document Scope extraction so this column lines up with // recommendedValue / actualValue. originalRecommendation: coalesce(r.orig_data, ?), recommendationCount: CASE r.category WHEN ? THEN size(keys(apoc.map.clean( apoc.convert.fromJsonMap(coalesce(r.data_formatted, ?)), [], [?]))) WHEN ? THEN apoc.coll.max([?, size([k IN keys(recMap) WHERE (recAllowed IS NULL OR k IN recAllowed) AND coalesce(toString(recMap[k]), ?) <> ?])]) ELSE ? END, actualValue: CASE r.category WHEN ? THEN coalesce(d.fileName, ?) WHEN ? THEN apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?) + ? + coalesce(artifact.name, ?) WHEN ? THEN coalesce(subArtifact.name, ?) WHEN ? THEN apoc.convert.toJson( CASE toLower(coalesce(d.tmfLevel, ?)) WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), country: coalesce(d.country, ?)} WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), siteId: coalesce(site.tildaid, ?), siteName: coalesce(site.name, ?), siteNumber: siteNumber} ELSE {scope: toLower(coalesce(d.tmfLevel, ?))} END) WHEN ? THEN attributesJson ELSE ? END, // accuracyCount: for Document Metadata, the number of keys whose // recommended value matches the actual value (?–N out of // recommendationCount). For all other categories, ? or ? (mirrors // ? or ? for other categories. NULL when not yet actioned. accuracyCount: CASE r.category WHEN ? THEN size([k IN keys(apoc.map.clean(apoc.convert.fromJsonMap(coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?)), [], [?])) WHERE apoc.map.clean(apoc.convert.fromJsonMap(coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?)), [], [?])[k] = apoc.map.clean(apoc.convert.fromJsonMap(coalesce(attributesJson, ?)), [], [?])[k]]) WHEN ? THEN size([k IN keys(cmpMap) WHERE (cmpAllowed IS NULL OR k IN cmpAllowed) AND coalesce(toString(cmpMap[k]), ?) <> ? AND toLower(coalesce(toString(cmpMap[k]), ?)) = toLower(coalesce(toString((CASE toLower(coalesce(d.tmfLevel, ?)) WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), country: coalesce(d.country, ?)} WHEN ? THEN {scope: toLower(coalesce(d.tmfLevel, ?)), siteId: coalesce(site.tildaid, ?), siteName: coalesce(site.name, ?), siteNumber: siteNumber} ELSE {scope: toLower(coalesce(d.tmfLevel, ?))} END)[k]), ?))]) ELSE CASE (CASE r.category WHEN ? THEN coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?) = coalesce(d.fileName, ?) WHEN ? THEN coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?) = ( apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?) + ? + coalesce(artifact.name, ?)) WHEN ? THEN coalesce( CASE WHEN coalesce(r.orig_data,?) <> ? THEN r.orig_data END, CASE WHEN coalesce(r.data_formatted,?) <> ? THEN r.data_formatted END, r.data, ?) = coalesce(subArtifact.name, ?) ELSE CASE WHEN r.category IN [?, ?, ?, ?] THEN r.user_action = ? OR (r.user_action = ? AND coalesce(r.comment, ?) = ?) END END) WHEN true THEN ? WHEN false THEN ? ELSE null END END, comment: r.comment, statePromotedBy: statePromotedBy, statePromotedByName: statePromotedByName } ) YIELD node RETURN node
writedashrsvc
19
89 ms
1.05 s
1.67 s
flat
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Organization policies=org-work-order-read MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORG…
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Organization policies=org-work-order-read MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORGANIZATION_TO_ACTOR]->(a) WHERE a.state <> ? AND a.delpending = false AND x.name IN $lists.roles_0 RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient UNION // scope=Organization policies=org-work-order-read MATCH (u)<-[:FOR_USER]-(da:Actor)<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study)-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(x:Role)<-[:APPOINTED_AS]-(sa:Actor), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias:?}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND da.delpending = false AND sa.state <> ? AND sa.delpending = false AND x.name IN $lists.roles_1 AND ? IN apoc.text.split(coalesce(x.tags, ?), ?) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient } RETURN checkIdx, User, Organization, Study, Site, Patient
virtual-assistant
19
55 ms
1.05 s
1.00 s
flat
MATCH (u:User{tildaid:$user}), (o:Organization{delpending:false, alias:$org}) CALL (u, o) { OPTIONAL MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o), (a)-[:APPOINTED_AS]->(r:Role) WHERE not r.name = ? AND c…
MATCH (u:User{tildaid:$user}), (o:Organization{delpending:false, alias:$org}) CALL (u, o) { OPTIONAL MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o), (a)-[:APPOINTED_AS]->(r:Role) WHERE not r.name = ? AND coalesce(a.state, ?) <> ? return r{.*} UNION MATCH (u)<-[:FOR_USER]-(da:Actor{delpending:false})<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study{delpending:false})-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(r:Role)<-[:APPOINTED_AS]-(sa:Actor{delpending:false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization{alias:?}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND ? IN apoc.text.split(coalesce(r.tags, ?), ?) return distinct r{.*} } WITH u, o, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles, ANY(n IN COLLECT(r.external) WHERE n = true) as external, ANY(n IN COLLECT(r.name) WHERE n = ?) as isPatient, ALL(n IN COLLECT(r.piiAccess) WHERE n = false) as hidePhi WITH u, o, {organization:o{.*}, external: external, isPatient: isPatient, hidePhi: hidePhi, roles: roles, displayRoles: displayRoles } as context CALL (u, o) { MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:STAFF_TO_ACTOR]-(si:Site{delpending:false})-[:SITE_TO_SMO]->(:Smo)-[:IS_AN_ORG]->(o) WHERE coalesce(a.state, ?) <> ? OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, si, a, r order by r.displayName WITH u, o, si, a, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles WITH CASE when not si is null then {siteId: si.tildaid, roles: roles, displayRoles: displayRoles} end as si return collect(si) as sites, apoc.coll.flatten(collect(si.roles)) as siteRoles } CALL (u, o) { CALL (u, o) { MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false, orgId:o.tildaid}) WHERE coalesce(a.state, ?) <> ? // Required pipeline barrier: without it the actor match re-expands // once per study in the org (?.0M -> 32k db hits, measured in Go). WITH DISTINCT u, o, a MATCH (a)<-[:STUDY_TO_ACTOR]-(s:Study{delpending:false})-[:STUDY_TO_ORG]->(o) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) RETURN s, r UNION // Delegated engagement Actors: orgId is TildaScale? roles. WITH s, r order by r.displayName WITH s, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles // Ordered so the studies array is a stable sequence for clients. WITH s, {studyId: s.tildaid, roles: roles, displayRoles: displayRoles, srcOrgId: s.srcorgid} as st ORDER BY s.name, s.tildaid return collect(st) as studies, apoc.coll.flatten(collect(st.roles)) as studyRoles } with distinct context, studies, apoc.coll.toSet(apoc.coll.flatten(collect(studyRoles))) as allStudyRoles, apoc.coll.toSet(apoc.coll.flatten(collect(siteRoles))) as siRoles with context, studies, apoc.coll.toSet(apoc.coll.flatten([context.roles, allStudyRoles, siRoles])) as allRoles return context{.*, studies: studies, allRoles: allRoles} as rc
feedsvc
19
103 ms
1.05 s
1.89 s
flat
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL { WITH u, o, c // scope=Organization policies=org-read MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORGANIZATIO…
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL { WITH u, o, c // scope=Organization policies=org-read MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORGANIZATION_TO_ACTOR]->(a) WHERE a.state <> ? AND a.delpending = false AND x.name IN $lists.roles_0 WITH * WHERE o.tildaid = c.id RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient UNION WITH u, o, c // scope=Organization policies=org-read MATCH (u)<-[:FOR_USER]-(da:Actor)<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study)-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(x:Role)<-[:APPOINTED_AS]-(sa:Actor), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias:$tildaScaleAlias}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND da.delpending = false AND sa.state <> ? AND sa.delpending = false AND x.name IN $lists.roles_1 AND ? IN apoc.text.split(coalesce(x.tags, ?), ?) WITH * WHERE o.tildaid = c.id RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient } RETURN checkIdx, User, Organization, Study, Site, Patient
onboardingsvc
1
854 ms
975 ms
854 ms
flat
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL { WITH u, o, c // scope=Organization policies=org-read MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORGANIZATIO…
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL { WITH u, o, c // scope=Organization policies=org-read MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORGANIZATION_TO_ACTOR]->(a) WHERE a.state <> ? AND a.delpending = false AND x.name IN $lists.roles_0 RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient UNION WITH u, o, c // scope=Organization policies=org-read MATCH (u)<-[:FOR_USER]-(da:Actor)<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study)-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(x:Role)<-[:APPOINTED_AS]-(sa:Actor), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias:$tildaScaleAlias}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND da.delpending = false AND sa.state <> ? AND sa.delpending = false AND x.name IN $lists.roles_1 AND ? IN apoc.text.split(coalesce(x.tags, ?), ?) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient } RETURN checkIdx, User, Organization, Study, Site, Patient
onboardingsvc
1
747 ms
975 ms
747 ms
flat
match(org:Organization{tildaid:$leadOrgId}) with org match(lead:Lead)-[]-(org) with org, lead match(patient:Patient)<-[:LEAD_TO_PATIENT]-(lead) where lead.tildaid=$leadId with org, patient, lead match(patient)-[:HAS_PROTECTED_DATA_IN]->(ph…
match(org:Organization{tildaid:$leadOrgId}) with org match(lead:Lead)-[]-(org) with org, lead match(patient:Patient)<-[:LEAD_TO_PATIENT]-(lead) where lead.tildaid=$leadId with org, patient, lead match(patient)-[:HAS_PROTECTED_DATA_IN]->(phi:Phi) with * optional match(lead)-[:LEAD_TO_ADVOCATE]-(adv:Advocate) with * match(patient)-[]-(mg:MedicalGroup) with * match(lead)-[:LEAD_TO_STUDY]->(study:Study{tildaid:lead.studyid}) with * optional match(lead)-[]-(task:Task) with * optional match(advUser:User{tildaid:adv.userid}) with * optional match(lead)-[]-(:Task)-[]-(:Inbox{type:?})-[]-(assigned:User) with * optional match(formV2:FormInstance)-[:SCREENER_TO_LEAD]->(lead) with * optional match(form:ParticipantForm)-[:PARTICIPANTFORM_TO_PATIENT]->(patient)call{with * optional match (lead)-[:LEAD_TO_PATIENT]->(patient)<-[:RESEARCH_SUBJECT]-(cp:CarePlan)-[:EXECUTE_SOA]-(s:ScheduleOfActivities)-[:SOA_TO_PLAN_DEFINITION]-(pd:DslPlanDefinition)-[:PLAN_DEFINITION_TO_STUDY]-(study) where lead.status=? return cp order by cp.createdat desc limit ?} return patient, lead, phi, mg, study, task, adv, advUser, assigned, formV2, form, case cp.status when ?, ? then cp end, org limit $leadLimit
patientsvc
1
798 ms
975 ms
798 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
3
383 ms
962 ms
574 ms
flat
MATCH (study:Study )-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE NOT EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) AND EXISTS((study)-[:STUDY_TO_ORG{inherited:false}]-(:Organization{orgType:?})) CALL { WITH t MATCH (t)<-[:CREATED_FRO…
MATCH (study:Study )-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE NOT EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) AND EXISTS((study)-[:STUDY_TO_ORG{inherited:false}]-(:Organization{orgType:?})) CALL { WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantControl)-[:PARTICIPANT_CONTROL]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw UNION ALL WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw } WITH DISTINCT study, t, ptc, pw MATCH (t)-[:BELONGS_TO]-(:Inbox)-[:MANAGED_BY]-(o:Organization) MATCH (ptc)-[:BELONGS_TO_TASKCONFIG]-(tc:TaskConfig) OPTIONAL MATCH (t)-[:BELONGS_TO]-(taskInbox:Inbox{type:?})--(taskUser:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:StudySiteActor)-[:STUDYSITEACTOR_TO_ACTOR]-(:Actor{delpending:false})-[:FOR_USER]-(user:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(scopeSite:Site)-[:SITE_TO_SMO]-(:Smo)-[:IS_AN_ORG]-(o) WITH DISTINCT study, t, o, tc, taskInbox, taskUser, user, scopeSite SKIP $skip LIMIT $limit WITH collect({study:study, t:t, o:o, tc:tc, taskInbox:taskInbox, taskUser:taskUser, user:user, scopeSite:scopeSite}) AS rows, collect(DISTINCT study) AS studies, collect(DISTINCT o) AS orgs, collect(DISTINCT scopeSite) AS sites CALL { WITH studies UNWIND studies AS study OPTIONAL MATCH (study)-[:STUDY_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(r:Role) WHERE r.name IN [?, ?, ?] RETURN study.tildaid AS studyId, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS piTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS smoTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS raTildaid } WITH rows, orgs, sites, collect({studyId: studyId, pi: piTildaid, smo: smoTildaid, ra: raTildaid}) AS studyRoles CALL { WITH orgs UNWIND orgs AS o OPTIONAL MATCH (o)-[:ORGANIZATION_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN o.tildaid AS orgId, collect(DISTINCT u.tildaid) AS adminTildaid } WITH rows, sites, studyRoles, collect({orgId: orgId, admin: adminTildaid}) AS orgRoles CALL { WITH sites UNWIND (CASE WHEN size(sites) = ? THEN [null] ELSE sites END) AS scopeSite OPTIONAL MATCH (scopeSite)-[:STAFF_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN scopeSite.tildaid AS siteId, collect(DISTINCT u.tildaid) AS siteAdminTildaid } WITH rows, studyRoles, orgRoles, collect({siteId: siteId, admin: siteAdminTildaid}) AS siteRoles UNWIND rows AS row WITH row, [x IN studyRoles WHERE x.studyId = row.study.tildaid][?] AS sr, [x IN orgRoles WHERE x.orgId = row.o.tildaid][?] AS orr, [x IN siteRoles WHERE row.scopeSite IS NOT NULL AND x.siteId = row.scopeSite.tildaid][?] AS str RETURN DISTINCT row.t AS task, apoc.convert.toJson({userTildaid: row.user.tildaid, userName: row.user.name, PITildaid: sr.pi, studyOwnerTildaid: sr.smo, regAnalystTildaid: sr.ra, orgAdminTildaid: orr.admin, studyName: row.study.name, siteName: row.scopeSite.name, siteAdminTildaid: CASE WHEN row.scopeSite IS NULL THEN [] ELSE str.admin END}) AS details, row.tc.who AS dsnWho, row.o.alias AS orgAlias, row.taskInbox, row.taskUser.tildaid AS taskUserId
tusker
2
422 ms
950 ms
801 ms
flat
MATCH (u:User{tildaid:$userId}), (o:Organization{delpending:false, alias:$orgAlias}) call { with u, o // An Inactive actor holds no roles (ENG-?): its roles would otherwise // still feed hidePhi, the role list and every policy match. OPTIO…
MATCH (u:User{tildaid:$userId}), (o:Organization{delpending:false, alias:$orgAlias}) call { with u, o // An Inactive actor holds no roles (ENG-?): its roles would otherwise // still feed hidePhi, the role list and every policy match. OPTIONAL MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o), (a)-[:APPOINTED_AS]->(r:Role) WHERE not r.name = ? AND coalesce(a.state, ?) <> ? return r{.*} UNION with u, o // Delegated engagements in o. Only the delegated roles cross over — // the TildaScale Actor?s list. // Staged with a barrier, not one comma-joined MATCH: the da->r<-sa, da->sa // cycle made planning cost far more than executing the query. MATCH (u)<-[:FOR_USER]-(da:Actor{delpending:false})<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study{delpending:false})-[:STUDY_TO_ORG]->(o) WHERE st.srcorgid = o.tildaid AND da.state <> ? WITH DISTINCT da MATCH (da)-[:DELEGATED_FROM]->(sa:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(:Organization{alias:$tildaScaleAlias}) WHERE sa.state <> ? MATCH (da)-[:APPOINTED_AS]->(r:Role) WHERE (sa)-[:APPOINTED_AS]->(r) AND $orgDelegatedTag IN apoc.text.split(coalesce(r.tags, ?), ?) return distinct r{.*} } WITH u, o, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles, ANY(n IN COLLECT(r.external) WHERE n = true) as external, ANY(n IN COLLECT(r.name) WHERE n = ?) as isPatient, ALL(n IN COLLECT(r.piiAccess) WHERE n = false) as hidePhi WITH u, o, {organization:o{.*}, external: external, isPatient: isPatient, hidePhi: hidePhi, roles: roles, displayRoles: displayRoles } as context CALL {WITH u, o MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:STAFF_TO_ACTOR]-(si:Site{delpending:false})-[:SITE_TO_SMO]->(:Smo)-[:IS_AN_ORG]->(o) WHERE coalesce(a.state, ?) <> ? OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, si, a, r order by r.displayName WITH u, o, si, a, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles WITH CASE when not si is null then {siteId: si.tildaid, roles: roles, displayRoles: displayRoles} end as si return collect(si) as sites, apoc.coll.flatten(collect(si.roles)) as siteRoles } CALL {WITH u, o // WITH DISTINCT is a required pipeline barrier (see the studyMembership note // in scope.go): without it (u)<-[:FOR_USER]-(a) re-expands once per study in // the org — ?.0M -> 32k db hits. Splitting the MATCH without DISTINCT does // nothing; the barrier is what forbids the bad join order. Not applied to the // sites or org-roles subqueries, where it measured neutral or worse. // No longer OPTIONAL: the subquery ends in an ungrouped aggregation, so zero // matches still yield one row with empty collections. CALL {WITH u, o MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false, orgId:o.tildaid}) WHERE coalesce(a.state, ?) <> ? WITH DISTINCT u, o, a MATCH (a)<-[:STUDY_TO_ACTOR]-(s:Study{delpending:false})-[:STUDY_TO_ORG]->(o) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) RETURN s, a, r UNION // Delegated engagement Actors: orgId is TildaScale? roles. WITH s, r order by r.displayName WITH s, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles // Ordered so the studies array is a stable sequence for clients; the pipeline // that replaced the old (u,o,s,a) grouping otherwise leaves it plan-dependent. WITH s, CASE when not s is null then {studyId: s.tildaid, name: s.name, roles: roles, displayRoles: displayRoles, srcOrgId: s.srcorgid} end as st ORDER BY s.name, s.tildaid return collect(st) as studies, apoc.coll.flatten(collect(st.roles)) as studyRoles } with distinct context, studies, apoc.coll.toSet(apoc.coll.flatten(collect(studyRoles))) as allStudyRoles, apoc.coll.toSet(apoc.coll.flatten(collect(siteRoles))) as siRoles with context, studies, apoc.coll.toSet(apoc.coll.flatten([context.roles, allStudyRoles, siRoles])) as allRoles return context{.*, studies: studies, allRoles: allRoles}
onboardingsvc
2
264 ms
950 ms
525 ms
flat
MATCH (pv:ParticipantVisit) WHERE (pv.edcStatus IS NULL OR pv.edcStatus = ? OR pv.edcStatus = ? OR pv.edcStatus = ?) AND (pv.status = ? OR pv.status = ?) AND pv.deltimestamp = ? MATCH (cp:CarePlan {tildaid: pv.carePlanId})-[:EXECUTE_SOA]- …
MATCH (pv:ParticipantVisit) WHERE (pv.edcStatus IS NULL OR pv.edcStatus = ? OR pv.edcStatus = ? OR pv.edcStatus = ?) AND (pv.status = ? OR pv.status = ?) AND pv.deltimestamp = ? MATCH (cp:CarePlan {tildaid: pv.carePlanId})-[:EXECUTE_SOA]- (soa:ScheduleOfActivities)-[:SOA_TO_PLAN_DEFINITION]- (pd:DslPlanDefinition) MATCH (pd)-[:PLAN_DEFINITION_TO_STUDY]-(st:Study) MATCH (pd)-[:PLAN_DEFINITION_TO_SITE]-(site:Site)-[:SITE_TO_SMO]- (smo)-[:IS_AN_ORG]-(org:Organization) OPTIONAL MATCH (visit:VisitV2)-[:BELONGS_TO_VISIT]-(pv) WITH pv, cp, st, site, org, visit OPTIONAL MATCH (pv)-[:PARTICIPANT_ACTIVITY]->(emptyPa:ParticipantActivity) WHERE (emptyPa.edcStatus IS NULL OR emptyPa.edcStatus = ?) AND emptyPa.deltimestamp = ? WITH pv, cp, st, site, org, visit, collect(emptyPa) AS emptyPas OPTIONAL MATCH (pv)-[:PARTICIPANT_ACTIVITY]->(pa:ParticipantActivity)-[:BELONGS_TO_ACTIVITY]->(act:ActivityV2) WHERE pa.deltimestamp = ? RETURN pv, cp, st, site, org, visit, emptyPas, collect({pa: pa, activity: act}) AS paActPairs LIMIT ?
execsvc
2
281 ms
950 ms
561 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
2
394 ms
950 ms
786 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
6
347 ms
950 ms
745 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
7
281 ms
942 ms
875 ms
flat
MATCH (b:Budget {tildaid: $budgetTildaid}) WITH b.name AS name, b, CASE b.status WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? ELSE ? END AS statusPriority WITH name, b, statusPriority ORDER BY name, statusPriority WITH name, col…
MATCH (b:Budget {tildaid: $budgetTildaid}) WITH b.name AS name, b, CASE b.status WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? ELSE ? END AS statusPriority WITH name, b, statusPriority ORDER BY name, statusPriority WITH name, collect(b) AS budgetsPerGroup WITH name, budgetsPerGroup[?] AS b ORDER BY b.name ASC WITH collect(b) AS budgetList WITH budgetList, size(budgetList) AS totalCount WITH budgetList[$pageSkip..$pageEnd] AS paginatedBudgets, totalCount UNWIND paginatedBudgets AS b OPTIONAL MATCH (u:User {tildaid: b.configuredBy}) OPTIONAL MATCH (b)-[:BUDGET_TO_SITE|BUDGET_TO_SITE_DRAFT]->(site:Site) OPTIONAL MATCH (b)-[:BUDGET_TO_STUDY]->(study:Study) OPTIONAL MATCH (b)-[:BUDGET_TO_SECTION]->(s:Section) OPTIONAL MATCH (s)-[:SECTION_TO_BUDGET_ENTRY]->(be:BudgetEntry) OPTIONAL MATCH (be)-[:BUDGET_ENTRY_TO_ACTIVITY]->(act:ActivityV2) // Get trigger counts for budget entries OPTIONAL MATCH (be)-[:BUDGET_ENTRY_TO_BRANCH_CONFIG]->(bc:BranchConfig) OPTIONAL MATCH (bc)-[:BRANCH_CG_ALL_NEXT|BRANCH_CG_ANY_NEXT]->(cg:BranchConditionGroup) OPTIONAL MATCH (cg)-[:CG_TO_CONDITION]->(c:BranchCondition) WITH b, totalCount, u, site, study, s, be, act, COUNT(DISTINCT c) as triggerCount // Fetch linked budgets OPTIONAL MATCH (b)-[:BUDGET_TO_BUDGET*?..]-(linkedBudget:Budget) WHERE linkedBudget.tildaid <> b.tildaid WITH b, totalCount, u, collect(DISTINCT site) as sites, study, s, be, act, triggerCount, collect(linkedBudget) as tempLinkedBudgets // Handle linked budgets info collection WITH b, totalCount, u, sites, study, s, be, act, triggerCount, [budget IN tempLinkedBudgets | { budget: budget, sites: [(budget)-[:BUDGET_TO_SITE|BUDGET_TO_SITE_DRAFT]->(s2:Site) | s2], linkedUser: head([linkedUser IN [(budget)<-[:CONFIGURED_BY]-(u2:User) | u2] | linkedUser]), statusPriority: CASE budget.status WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? ELSE ? END }] as linkedBudgetsInfo // Sort linked budgets safely by handling empty collections WITH b, totalCount, u, sites, study, s, be, act, triggerCount, CASE WHEN size(linkedBudgetsInfo) > ? THEN apoc.coll.sortMulti( linkedBudgetsInfo, [?, ?] ) ELSE [] END as linkedBudgetsInfo // Final collection of data for node creation WITH b, u, sites, study.name AS studyName, study.sponsor AS sponsor, u.name AS configuredByName, totalCount, linkedBudgetsInfo, s, be, act, triggerCount WITH b, u, sites, studyName, sponsor, configuredByName, totalCount, linkedBudgetsInfo, s, be, act, triggerCount ORDER BY be.name ASC WITH b, u, sites, studyName, sponsor, configuredByName, totalCount, linkedBudgetsInfo, s, collect({entry: be, activity: act, triggerCount: triggerCount}) AS entriesWithActivities WITH b, u, sites, studyName, sponsor, configuredByName, totalCount, linkedBudgetsInfo, collect({section: s, entriesWithActivities: entriesWithActivities}) AS sectionsWithEntries CALL apoc.create.vNode( [?], { tildaid: b.tildaid, createdat: b.createdat, updatedat: b.updatedat, orgAlias: b.orgAlias, name: b.name, studyId: b.studyId, protocolVersionId: b.protocolVersionId, effectiveDate: b.effectiveDate, type: b.type, version: b.version, status: b.status, configuredBy: b.configuredBy, sourceBudgetId: b.sourceBudgetId, screenFailureRatioScreenFailed: b.screenFailureRatioScreenFailed, screenFailureRatioEnrolled: b.screenFailureRatioEnrolled, screenFailureAllowance: b.screenFailureAllowance, screenFailureCalculationMode: b.screenFailureCalculationMode, sections: [sectionEntry IN sectionsWithEntries | { tildaid: sectionEntry.section.tildaid, createdat: sectionEntry.section.createdat, updatedat: sectionEntry.section.updatedat, budgetId: sectionEntry.section.budgetId, name: sectionEntry.section.name, type: sectionEntry.section.type, budgetType: sectionEntry.section.budgetType, budgetEntries: [entryWithActivity IN sectionEntry.entriesWithActivities | { tildaid: entryWithActivity.entry.tildaid, createdat: entryWithActivity.entry.createdat, updatedat: entryWithActivity.entry.updatedat, budgetId: entryWithActivity.entry.budgetId, sectionId: entryWithActivity.entry.sectionId, name: entryWithActivity.entry.name, type: entryWithActivity.entry.type, settings: entryWithActivity.entry.settings, trigger: entryWithActivity.entry.trigger, budget: entryWithActivity.entry.budget, data: apoc.convert.fromJsonMap(entryWithActivity.entry.data), estimatedOccurrence: entryWithActivity.entry.estimatedOccurrence, amount: entryWithActivity.entry.amount, capType: entryWithActivity.entry.capType, capAmount: entryWithActivity.entry.capAmount, startingOccurrence: entryWithActivity.entry.startingOccurrence, isSettingsEditable: entryWithActivity.entry.isSettingsEditable, allowedSettings: entryWithActivity.entry.allowedSettings, triggerCount: entryWithActivity.triggerCount, mappedActivityId: CASE WHEN entryWithActivity.activity IS NOT NULL THEN entryWithActivity.activity.tildaid ELSE null END, activityTitle: CASE WHEN entryWithActivity.activity IS NOT NULL THEN entryWithActivity.activity.title ELSE null END }] }], siteInfo: [site IN sites | { id: site.tildaid, name: site.name }], studyName: studyName, sponsor: sponsor, configuredByName: configuredByName, budgetVersions: [info IN linkedBudgetsInfo | { tildaid: info.budget.tildaid, createdat: info.budget.createdat, updatedat: info.budget.updatedat, orgAlias: info.budget.orgAlias, name: info.budget.name, studyId: info.budget.studyId, protocolVersionId: info.budget.protocolVersionId, effectiveDate: info.budget.effectiveDate, type: info.budget.type, version: info.budget.version, status: info.budget.status, configuredBy: info.budget.configuredBy, sourceBudgetId: info.budget.sourceBudgetId, screenFailureRatioScreenFailed: info.budget.screenFailureRatioScreenFailed, screenFailureRatioEnrolled: info.budget.screenFailureRatioEnrolled, screenFailureAllowance: info.budget.screenFailureAllowance, screenFailureCalculationMode: info.budget.screenFailureCalculationMode, error: info.budget.error, studyName: info.study.name, sponsor: info.study.sponsor, configuredByName: info.user.name, siteInfo: [site IN info.sites | { id: site.tildaid, name: site.name }] }] } ) YIELD node AS budgetNode RETURN budgetNode, totalCount
writefinsvc
3
181 ms
925 ms
538 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
3
206 ms
925 ms
616 ms
flat
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Organization policies=org-work-order-read MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORG…
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Organization policies=org-work-order-read MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORGANIZATION_TO_ACTOR]->(a) WHERE a.state <> ? AND a.delpending = false AND x.name IN $lists.roles_0 RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient UNION // scope=Organization policies=org-work-order-read MATCH (u)<-[:FOR_USER]-(da:Actor)<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study)-[:STUDY_TO_ORG]->(o), (da)-[:APPOINTED_AS]->(x:Role)<-[:APPOINTED_AS]-(sa:Actor), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias:?}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND da.delpending = false AND sa.state <> ? AND sa.delpending = false AND x.name IN $lists.roles_1 AND ? IN apoc.text.split(coalesce(x.tags, ?), ?) RETURN DISTINCT c.idx AS checkIdx, u AS User, o AS Organization, null AS Study, null AS Site, null AS Patient } RETURN checkIdx, User, Organization, Study, Site, Patient
virtual-assistant
3
331 ms
925 ms
990 ms
flat
MATCH (d:Document) -[:DOCUMENT_VERSION] - (dv: DocumentVersion {tildaid: $id}) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) OPTIONAL MATCH (d…
MATCH (d:Document) -[:DOCUMENT_VERSION] - (dv: DocumentVersion {tildaid: $id}) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) OPTIONAL MATCH (d)-[:DOC_TO_ORG]->(o:Organization) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (uploader: User) OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) CALL { WITH dv OPTIONAL MATCH (dv)<-[:DOCUMENT_SOURCE_TO_VERSION]-(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(da: DocAttribute) WITH collect([coalesce(da.key, ?), coalesce(da.value, ?)]) AS attributePairs WITH apoc.map.fromPairs(attributePairs) AS attributesMap WITH apoc.convert.toJson(attributesMap) AS attributesJson RETURN attributesJson } WITH d, dv, o, study, site, zone, section, artifact, subArtifact, uploader, attributesJson CALL apoc.create.vNode([?], { documentId: d.tildaid, orgId: o.tildaid, orgName: o.name, orgAlias: o.alias, studyId: study.tildaid, studyName: study.name, siteId: COALESCE(site.tildaid, ?), siteName: COALESCE(site.name, ?), zone: zone.name, zoneId: zone.tildaid, section: section.name, sectionId: section.tildaid, artifact: artifact.name, artifactId: artifact.tildaid, subArtifact: subArtifact.name, subArtifactId: subArtifact.tildaid, documentMetadata: attributesJson, uploadedByName: uploader.name, uploadedById: uploader.tildaid, createdat: d.createdat, updatedat: dv.updatedat, artifactNumber: apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?), subArtifactNumber: case when subArtifact.number is null then null else apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(subArtifact.number, ?)), ?, ?) end, tmfLevel: d.tmfLevel, country: d.country, language: d.language, fileName: d.fileName } ) YIELD node RETURN node
writedashrsvc
7
180 ms
912 ms
628 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
7
179 ms
912 ms
629 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
8
387 ms
900 ms
981 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
10
167 ms
875 ms
833 ms
flat
MATCH (d:Document) -[:DOCUMENT_VERSION] - (dv: DocumentVersion {tildaid: $id}) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) OPTIONAL MATCH (d…
MATCH (d:Document) -[:DOCUMENT_VERSION] - (dv: DocumentVersion {tildaid: $id}) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) OPTIONAL MATCH (d)-[:DOC_TO_ORG]->(o:Organization) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (uploader: User) OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) CALL { WITH dv OPTIONAL MATCH (dv)<-[:DOCUMENT_SOURCE_TO_VERSION]-(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(da: DocAttribute) WITH collect([coalesce(da.key, ?), coalesce(da.value, ?)]) AS attributePairs WITH apoc.map.fromPairs(attributePairs) AS attributesMap WITH apoc.convert.toJson(attributesMap) AS attributesJson RETURN attributesJson } WITH d, dv, o, study, site, zone, section, artifact, subArtifact, uploader, attributesJson CALL apoc.create.vNode([?], { documentId: d.tildaid, orgId: o.tildaid, orgName: o.name, orgAlias: o.alias, studyId: study.tildaid, studyName: study.name, siteId: COALESCE(site.tildaid, ?), siteName: COALESCE(site.name, ?), zone: zone.name, zoneId: zone.tildaid, section: section.name, sectionId: section.tildaid, artifact: artifact.name, artifactId: artifact.tildaid, subArtifact: subArtifact.name, subArtifactId: subArtifact.tildaid, documentMetadata: attributesJson, uploadedByName: uploader.name, uploadedById: uploader.tildaid, createdat: d.createdat, updatedat: dv.updatedat, artifactNumber: apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?), subArtifactNumber: case when subArtifact.number is null then null else apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(subArtifact.number, ?)), ?, ?) end, tmfLevel: d.tmfLevel, country: d.country, language: d.language, fileName: d.fileName } ) YIELD node RETURN node
writedashrsvc
6
128 ms
850 ms
759 ms
flat
MATCH (study:Study {tildaid: $studyId})-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) CALL { WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:P…
MATCH (study:Study {tildaid: $studyId})-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) CALL { WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantControl)-[:PARTICIPANT_CONTROL]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw UNION ALL WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw } WITH DISTINCT study, t, ptc, pw MATCH (t)-[:BELONGS_TO]-(:Inbox)-[:MANAGED_BY]-(o:Organization) MATCH (ptc)-[:BELONGS_TO_TASKCONFIG]-(tc:TaskConfig) OPTIONAL MATCH (t)-[:BELONGS_TO]-(taskInbox:Inbox{type:?})--(taskUser:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:StudySiteActor)-[:STUDYSITEACTOR_TO_ACTOR]-(:Actor{delpending:false})-[:FOR_USER]-(user:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(scopeSite:Site)-[:SITE_TO_SMO]-(:Smo)-[:IS_AN_ORG]-(o) WITH DISTINCT study, t, o, tc, taskInbox, taskUser, user, scopeSite SKIP $skip LIMIT $limit WITH collect({study:study, t:t, o:o, tc:tc, taskInbox:taskInbox, taskUser:taskUser, user:user, scopeSite:scopeSite}) AS rows, collect(DISTINCT study) AS studies, collect(DISTINCT o) AS orgs, collect(DISTINCT scopeSite) AS sites CALL { WITH studies UNWIND studies AS study OPTIONAL MATCH (study)-[:STUDY_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(r:Role) WHERE r.name IN [?, ?, ?] RETURN study.tildaid AS studyId, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS piTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS smoTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS raTildaid } WITH rows, orgs, sites, collect({studyId: studyId, pi: piTildaid, smo: smoTildaid, ra: raTildaid}) AS studyRoles CALL { WITH orgs UNWIND orgs AS o OPTIONAL MATCH (o)-[:ORGANIZATION_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN o.tildaid AS orgId, collect(DISTINCT u.tildaid) AS adminTildaid } WITH rows, sites, studyRoles, collect({orgId: orgId, admin: adminTildaid}) AS orgRoles CALL { WITH sites UNWIND (CASE WHEN size(sites) = ? THEN [null] ELSE sites END) AS scopeSite OPTIONAL MATCH (scopeSite)-[:STAFF_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN scopeSite.tildaid AS siteId, collect(DISTINCT u.tildaid) AS siteAdminTildaid } WITH rows, studyRoles, orgRoles, collect({siteId: siteId, admin: siteAdminTildaid}) AS siteRoles UNWIND rows AS row WITH row, [x IN studyRoles WHERE x.studyId = row.study.tildaid][?] AS sr, [x IN orgRoles WHERE x.orgId = row.o.tildaid][?] AS orr, [x IN siteRoles WHERE row.scopeSite IS NOT NULL AND x.siteId = row.scopeSite.tildaid][?] AS str RETURN DISTINCT row.t AS task, apoc.convert.toJson({userTildaid: row.user.tildaid, userName: row.user.name, PITildaid: sr.pi, studyOwnerTildaid: sr.smo, regAnalystTildaid: sr.ra, orgAdminTildaid: orr.admin, studyName: row.study.name, siteName: row.scopeSite.name, siteAdminTildaid: CASE WHEN row.scopeSite IS NULL THEN [] ELSE str.admin END}) AS details, row.tc.who AS dsnWho, row.o.alias AS orgAlias, row.taskInbox, row.taskUser.tildaid AS taskUserId
tusker
6
98 ms
850 ms
579 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
6
132 ms
850 ms
782 ms
flat
match(phi:Phi)<-[r:HAS_PROTECTED_DATA_IN]-(p:Patient)-[:ORGANIZATION_TO_PATIENT]-(:Organization{tildaid:$phiOrgId}) where (tolower(phi.dob) contains tolower($phiFinder0) ) or tolower(phi.email) contains tolower($phiFinder1) or tolower(phi.…
match(phi:Phi)<-[r:HAS_PROTECTED_DATA_IN]-(p:Patient)-[:ORGANIZATION_TO_PATIENT]-(:Organization{tildaid:$phiOrgId}) where (tolower(phi.dob) contains tolower($phiFinder0) ) or tolower(phi.email) contains tolower($phiFinder1) or tolower(phi.mobilephone) contains tolower($phiFinder2) with phi, p match(p)-[]-(mg:MedicalGroup) with phi, p, mg optional match(p)-[r:USER_TO_PATIENT]-(u:User) with u.tildaid as patUserId, phi, p, mg optional match(p)-[r:INTERESTED_CONDITIONS]->(cond:AdvCampaignCondition) with patUserId, phi, p, mg, collect(cond.tildaid) as condIds with * optional match(p)-[:BINDER_FOR]-(:Binder{binderType:?, scope:?})-[:INCLUDES]-(doc:Document{docTypeName:?})-[:BELONGS_TO]-(pdo:ParticipantDocOverlay{participantReviewed:true}) with count(pdo) as pdoCount, phi, p, mg, condIds, patUserId with * optional match(adv:Advocate{orgid:$phiOrgId, userid:patUserId}) with * match(phi)-[]-(ehrPhi:EhrPhi) return phi, p, mg, ehrPhi, condIds, patUserId, pdoCount, adv limit $pgLimit
patientsvc
6
88 ms
850 ms
521 ms
flat
match(q:Query {tildaid: $id}) match(c:CarePlan) where c.tildaid=q.careplanId match(soa:ScheduleOfActivities) where soa.tildaid=c.soaId match(pd:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(site:Site) where pd.tildaid=soa.planDefinitionId…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
7
113 ms
825 ms
785 ms
flat
// First part for StudySiteUser scope match (:StudySiteDuty)-[:STUDYSITEDUTY_TO_STUDYSITEACTOR]->(scopeUser:StudySiteActor{delpending:false}) with distinct scopeUser match (scopeUser)-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(sitePd:DslPlanDe…
// First part for StudySiteUser scope match (:StudySiteDuty)-[:STUDYSITEDUTY_TO_STUDYSITEACTOR]->(scopeUser:StudySiteActor{delpending:false}) with distinct scopeUser match (scopeUser)-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(sitePd:DslPlanDefinition{type:?}) match (sitePd)-[:PLAN_DEFINITION_TO_ADOPTED_WORKFLOWS]->(w:WorkflowV2)<-[:TRIGGER_TO_WORKFLOW]-(t:Trigger{scope:?}) match (sitePd)-[:PLAN_DEFINITION_TO_STUDY]->(st:Study)-[:STUDY_TO_ORG]->(o:Organization{orgType:?}) match (sitePd)-[:PLAN_DEFINITION_TO_SITE]->(site:Site) match (scopeUser)-[:STUDYSITEACTOR_TO_ACTOR]->(actor:Actor{delpending:false})<-[:STUDY_TO_ACTOR]-(st) where not exists((scopeUser)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:ParticipantWorkflow)) return distinct scopeUser.tildaid as scopeTildaid, t.scope as workflowScope, st.tildaid as stId, o.alias as orgAlias, site.tildaid as siteId, scopeUser.roles as roles UNION // Second part for StudySite scope match (t:Trigger{scope:?})-[:TRIGGER_TO_WORKFLOW]->(w:WorkflowV2) match (w)<-[:PLAN_DEFINITION_TO_ADOPTED_WORKFLOWS]-(scopeSite:DslPlanDefinition{type:?}) where not exists((scopeSite)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:ParticipantWorkflow)) with distinct t.scope as workflowScope, scopeSite match (scopeSite)-[:PLAN_DEFINITION_TO_STUDY]->(st:Study)-[:STUDY_TO_ORG]->(o:Organization{orgType:?}) match (scopeSite)-[:PLAN_DEFINITION_TO_SITE]->(site:Site) return distinct scopeSite.tildaid as scopeTildaid, workflowScope, st.tildaid as stId, o.alias as orgAlias, site.tildaid as siteId, null as roles
regsvc
7
111 ms
825 ms
774 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
7
109 ms
825 ms
754 ms
flat
// First part for StudySiteUser scope match (:StudySiteDuty)-[:STUDYSITEDUTY_TO_STUDYSITEACTOR]->(scopeUser:StudySiteActor{delpending:false}) with distinct scopeUser match (scopeUser)-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(sitePd:DslPlanDe…
// First part for StudySiteUser scope match (:StudySiteDuty)-[:STUDYSITEDUTY_TO_STUDYSITEACTOR]->(scopeUser:StudySiteActor{delpending:false}) with distinct scopeUser match (scopeUser)-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(sitePd:DslPlanDefinition{type:?}) match (sitePd)-[:PLAN_DEFINITION_TO_ADOPTED_WORKFLOWS]->(w:WorkflowV2)<-[:TRIGGER_TO_WORKFLOW]-(t:Trigger{scope:?}) match (sitePd)-[:PLAN_DEFINITION_TO_STUDY]->(st:Study)-[:STUDY_TO_ORG]->(o:Organization{orgType:?}) match (sitePd)-[:PLAN_DEFINITION_TO_SITE]->(site:Site) match (scopeUser)-[:STUDYSITEACTOR_TO_ACTOR]->(actor:Actor{delpending:false})<-[:STUDY_TO_ACTOR]-(st) where not exists((scopeUser)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:ParticipantWorkflow)) return distinct scopeUser.tildaid as scopeTildaid, t.scope as workflowScope, st.tildaid as stId, o.alias as orgAlias, site.tildaid as siteId, scopeUser.roles as roles UNION // Second part for StudySite scope match (t:Trigger{scope:?})-[:TRIGGER_TO_WORKFLOW]->(w:WorkflowV2) match (w)<-[:PLAN_DEFINITION_TO_ADOPTED_WORKFLOWS]-(scopeSite:DslPlanDefinition{type:?}) where not exists((scopeSite)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:ParticipantWorkflow)) with distinct t.scope as workflowScope, scopeSite match (scopeSite)-[:PLAN_DEFINITION_TO_STUDY]->(st:Study)-[:STUDY_TO_ORG]->(o:Organization{orgType:?}) match (scopeSite)-[:PLAN_DEFINITION_TO_SITE]->(site:Site) return distinct scopeSite.tildaid as scopeTildaid, workflowScope, st.tildaid as stId, o.alias as orgAlias, site.tildaid as siteId, null as roles
regsvc
7
114 ms
825 ms
793 ms
flat
MATCH (d:Document) -[:DOCUMENT_VERSION] - (dv: DocumentVersion {tildaid: $id}) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) OPTIONAL MATCH (d…
MATCH (d:Document) -[:DOCUMENT_VERSION] - (dv: DocumentVersion {tildaid: $id}) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) OPTIONAL MATCH (d)-[:DOC_TO_ORG]->(o:Organization) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (uploader: User) OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) CALL { WITH dv OPTIONAL MATCH (dv)<-[:DOCUMENT_SOURCE_TO_VERSION]-(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(da: DocAttribute) WITH collect([coalesce(da.key, ?), coalesce(da.value, ?)]) AS attributePairs WITH apoc.map.fromPairs(attributePairs) AS attributesMap WITH apoc.convert.toJson(attributesMap) AS attributesJson RETURN attributesJson } WITH d, dv, o, study, site, zone, section, artifact, subArtifact, uploader, attributesJson CALL apoc.create.vNode([?], { documentId: d.tildaid, orgId: o.tildaid, orgName: o.name, orgAlias: o.alias, studyId: study.tildaid, studyName: study.name, siteId: COALESCE(site.tildaid, ?), siteName: COALESCE(site.name, ?), zone: zone.name, zoneId: zone.tildaid, section: section.name, sectionId: section.tildaid, artifact: artifact.name, artifactId: artifact.tildaid, subArtifact: subArtifact.name, subArtifactId: subArtifact.tildaid, documentMetadata: attributesJson, uploadedByName: uploader.name, uploadedById: uploader.tildaid, createdat: d.createdat, updatedat: dv.updatedat, artifactNumber: apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?), subArtifactNumber: case when subArtifact.number is null then null else apoc.text.lpad(toString(COALESCE(zone.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(section.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(artifact.number, ?)), ?, ?) + ? + apoc.text.lpad(toString(COALESCE(subArtifact.number, ?)), ?, ?) end, tmfLevel: d.tmfLevel, country: d.country, language: d.language, fileName: d.fileName } ) YIELD node RETURN node
writedashrsvc
9
80 ms
775 ms
615 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
9
89 ms
775 ms
756 ms
flat
MATCH (currentUser:User {deltimestamp:?}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true) AND currentUser.email = $ident OPTIONAL MATCH (supportUser:User {email:$supportEmail}) OPTIONAL MATCH (targetOrg:Organization {del…
MATCH (currentUser:User {deltimestamp:?}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true) AND currentUser.email = $ident OPTIONAL MATCH (supportUser:User {email:$supportEmail}) OPTIONAL MATCH (targetOrg:Organization {delpending:false, alias:$org}) OPTIONAL MATCH (currentUser)-[:FOR_USER]-(orgActor:Actor{delpending:false})-[:ORGANIZATION_TO_ACTOR]-(targetOrg) WHERE coalesce(orgActor.state, ?) <> ? OPTIONAL MATCH (currentUser)-[supports:SUPPORTS_ORG]-(targetOrg) WITH *, false AS repOf WITH *, CASE WHEN orgActor IS NULL THEN EXISTS { MATCH (currentUser)<-[:FOR_USER]-(da:Actor{delpending:false})<-[:STUDY_TO_DELEGATED_ACTOR]-(st:Study{delpending:false})-[:STUDY_TO_ORG]->(targetOrg), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor{delpending:false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization{alias:$scaleAlias}) WHERE st.srcorgid = targetOrg.tildaid AND da.state <> ? AND sa.state <> ? AND $delegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) } ELSE false END as delegated RETURN CASE WHEN orgActor is not null THEN currentUser WHEN delegated THEN currentUser WHEN repOf THEN currentUser WHEN supports is not null THEN coalesce(supportUser, currentUser) ELSE currentUser END as user, CASE WHEN orgActor is not null OR delegated OR repOf OR supports is not null THEN targetOrg ELSE null END as org, currentUser as tokenUser
virtual-assistant
9
106 ms
775 ms
945 ms
flat
match (pv:ParticipantVisit)-[:BELONGS_TO_PARTICIPANT_VISIT]-(v:VisitAppointment)-[:VISIT_APPOINTMENT_TO_CARE_PLAN]-(c:CarePlan)-[:RESEARCH_SUBJECT] -(p:Patient)-[:HAS_PROTECTED_DATA_IN]-(phi:Phi) where c.status IN [?,?] and v.startTime >= …
match (pv:ParticipantVisit)-[:BELONGS_TO_PARTICIPANT_VISIT]-(v:VisitAppointment)-[:VISIT_APPOINTMENT_TO_CARE_PLAN]-(c:CarePlan)-[:RESEARCH_SUBJECT] -(p:Patient)-[:HAS_PROTECTED_DATA_IN]-(phi:Phi) where c.status IN [?,?] and v.startTime >= datetime({epochMillis:$day1Start}) and v.startTime <= datetime({epochMillis:$day1End}) and coalesce(v.reminderStatus, ?) = ? match (c)-[:EXECUTE_SOA]-(s:ScheduleOfActivities)-[:SOA_TO_PLAN_DEFINITION] -(pd:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(si:Site)-[:SITE_TO_SMO]->(smo:Smo)-[:IS_AN_ORG]->(o:Organization) return v,phi,si,p,o
schedsvc
12
62 ms
700 ms
729 ms
flat
MATCH (dv:DocumentVersion {tildaid: $id})<-[:DOCUMENT_VERSION]-(d:Document) MATCH (r:Recommendation) WHERE r.doc_id = d.tildaid AND NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO…
MATCH (dv:DocumentVersion {tildaid: $id})<-[:DOCUMENT_VERSION]-(d:Document) MATCH (r:Recommendation) WHERE r.doc_id = d.tildaid AND NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO_ORGANIZATION]->(o:Organization) OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (u: User) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) CALL { WITH d, site OPTIONAL MATCH (study:Study{tildaid: d.studyId})<-[:PLAN_DEFINITION_TO_STUDY]- (pd:DslPlanDefinition{delpending:false, type:?})-[:PLAN_DEFINITION_TO_SITE]->(site) RETURN COALESCE(pd.siteNumber, ?) AS siteNumber } CALL { WITH dv OPTIONAL MATCH (dv)<-[:DOCUMENT_SOURCE_TO_VERSION]-(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(docAttr: DocAttribute) WITH collect([coalesce(docAttr.key, ?), coalesce(docAttr.value, ?)]) AS attributePairs WITH apoc.map.fromPairs(attributePairs) AS attributesMap With apoc.convert.toJson(attributesMap) AS attributesJson RETURN attributesJson } WITH r, ai, o, d, dv, zone, section, artifact, subArtifact, u, study, site, siteNumber, attributesJson, // Document Scope key stripping: reduce the rec JSON envelope to the keys // valid for its OWN scope so irrelevant keys (e.g. country on a site rec) // don?scope?country?scope?siteName?siteId?siteNumber?scope?scope???{}?{}?????{}?{?{?{????DRecommendation?t emit irrelevant rows (e.g. country on a site-scoped rec). recommendedValue: CASE WHEN r.category = ? AND recAllowed IS NOT NULL THEN apoc.convert.toJson(apoc.map.fromPairs([k IN keys(recMap) WHERE k IN recAllowed | [k, recMap[k]]])) ELSE coalesce(CASE WHEN coalesce(r.data_formatted, ?) <> ? THEN r.data_formatted END, r.data, ?) END, // originalRecommendation = the AI?Document Scope????Document Metadata?{}??Document Scope???Document Naming??TMF Artifact???.???.??? ??Sub Artifact??Document Scope??country???site?????Document Metadata??Document Metadata?????{}??????{}??{}??Document Scope?????country???site??????Document Naming???????TMF Artifact????????.???.??? ??Sub Artifact???????Document Format?Document Summary?Quality Control?PHI Issues?Confirm?Fix It????' } ) YIELD node RETURN node
writedashrsvc
12
49 ms
700 ms
556 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
25
64 ms
688 ms
785 ms
flat
MATCH (pa:ParticipantActivity{tildaid:$pmParticipantActivityId}) -[:BELONGS_TO_ACTIVITY]-(a:ActivityV2{tildaid:$pmActivityId}) // LEVEL ?: Participant objects (Questionnaire, DocumentSet, CheckList, TaskList) OPTIONAL MATCH (pa)-[:PARTICIP…
MATCH (pa:ParticipantActivity{tildaid:$pmParticipantActivityId}) -[:BELONGS_TO_ACTIVITY]-(a:ActivityV2{tildaid:$pmActivityId}) // LEVEL ?: Participant objects (Questionnaire, DocumentSet, CheckList, TaskList) OPTIONAL MATCH (pa)-[:PARTICIPANT_QUESTIONNAIRE|PARTICIPANT_DOCUMENTSET|PARTICIPANT_CHECKLIST|PARTICIPANT_TASKLIST]-(pObj1)- [:BELONGS_TO_QUESTIONNAIRE|BELONGS_TO_DOCUMENTSET|BELONGS_TO_CHECKLIST|BELONGS_TO_TASKLIST]-(obj1) WHERE (pObj1.delpending is null or pObj1.delpending <> true) AND obj1.tildaid=$pdSubObjectId // LEVEL ?: Sub-objects (Questions, Tables, DocUploads, Todos, TaskConfigs, ESign, Timer, Media, DocOverlay) OPTIONAL MATCH (pObj1)-[:PARTICIPANT_QUESTION|PARTICIPANT_TABLE|PARTICIPANT_DOC_UPLOAD|PARTICIPANT_DOC_OVERLAY|PARTICIPANT_TODO|PARTICIPANT_TASKCONFIG|PARTICIPANT_ESIGN|PARTICIPANT_TIMER|PARTICIPANT_MEDIA]-(pSubObj1)- [:BELONGS_TO_QUESTION|BELONGS_TO_TABLE|BELONGS_TO_DOC_UPLOAD|BELONGS_TO_DOC_OVERLAY|BELONGS_TO_TODOV2|BELONGS_TO_TASKCONFIG|BELONGS_TO_ESIGN|BELONGS_TO_TIMER|BELONGS_TO_MEDIA]-(subObj1) WHERE (pSubObj1.delpending is null or pSubObj1.delpending <> true) // LEVEL ?: For tables, get their questions and docuploads (one more level deep) OPTIONAL MATCH (pSubObj1)-[:PARTICIPANT_QUESTION|PARTICIPANT_DOC_UPLOAD]-(pSubSubObj1)- [:BELONGS_TO_QUESTION|BELONGS_TO_DOC_UPLOAD]-(subSubObj1) WHERE pSubObj1:ParticipantTable and (pSubSubObj1.delpending is null or pSubSubObj1.delpending <> true) // Fetch metadata for Level ? (table sub-objects) - counts plus the latest changelog, // which the visit PDF prints as the answer?Draft? hdmObjId, so fall back to // that when no object has the row?s Object Access (freeze/lock) changelogs separately from the per-cell changeLogCount OPTIONAL MATCH (hdmObj)-[:ALL_CHANGELOG]-(oaClog:ChangeLog{type:?}) WITH pa, a, obj1, pObj1, pSubObj1, subObj1, hdmObj, creatorUser, fallbackUser, pSubSubObjs, count(distinct oaClog) as rowObjAccessCount // Collect hdmObj with pSubSubObjs into hdmpSubSubObj WITH DISTINCT pa, a, obj1, pObj1, pSubObj1, subObj1, CASE WHEN size(pSubSubObjs) > ? THEN { pSubSubObjs: pSubSubObjs, hdmObj: hdmObj, objectAccessCount: rowObjAccessCount } ELSE null END as hdmpSubSubObj WITH DISTINCT pa, a, obj1, pObj1, pSubObj1, subObj1,collect(hdmpSubSubObj) as hdmpSubSubObjs // Fetch metadata for Level ? OPTIONAL MATCH (pSubObj1)-[:ALL_CHANGELOG]-(cl2:ChangeLog) WHERE cl2.type IN $pdClogTypes OPTIONAL MATCH (pSubObj1)-[:HAS_QUERY]-(q2:Query) WHERE q2.delpending = false AND q2.state <> ? OPTIONAL MATCH (pSubObj1)-[:BELONGS_TO]-(doc2:Document{archived:false}) OPTIONAL MATCH (doc2)-[:TAIL_CHANGELOG]-(docCL2:ChangeLog) OPTIONAL MATCH (doc2)-[:HAS_QUERY]-(dq2:Query) WHERE NOT dq2.state IN [?] // Aggregate Level ? WITH DISTINCT pa, a, obj1, pObj1, pSubObj1, subObj1, hdmpSubSubObjs, COUNT(DISTINCT dq2) AS doc2QueryCount, COUNT(DISTINCT cl2) AS clog2Count, COUNT(DISTINCT q2) AS query2Count, reduce(l = null, c IN COLLECT(DISTINCT cl2) | CASE WHEN l IS NULL OR c.createdat > l.createdat THEN c ELSE l END) AS lastClog2, doc2, docCL2 ORDER BY docCL2.createdat DESC WITH pa, a, obj1.tildaid AS obj1Id, obj1.title as obj1Title, pObj1, pSubObj1, subObj1, hdmpSubSubObjs, clog2Count, query2Count, lastClog2, CASE WHEN doc2 IS NOT NULL THEN { id: doc2.tildaid, docKind: doc2.docKind, versionNumber: doc2.versionNumber, fileName: doc2.fileName, uploadedBy: docCL2.who, uploadedAt: docCL2.createdat, size: doc2.size, status: doc2.status, pages: doc2.pages, docType: doc2.docTypeName, contentType: doc2.contentType, queryCount: doc2QueryCount, orgRelation: case when (doc2)-[:DOC_TO_ORG]->(:Organization{tildaid:$orgRelationOrgId}) then ? when (:Organization{tildaid:$orgRelationOrgId})<-[:DOC_SHARED_TO_ORG]-(:DocumentShare)-[:REFERS_TO]->(doc2) then ? else ? end } END as opDoc2 With pa, a, obj1Id, obj1Title, pObj1, pSubObj1, subObj1, hdmpSubSubObjs, clog2Count, query2Count, lastClog2, COLLECT(opDoc2) as opdocs2 WITH pa, a, obj1Id, obj1Title, pObj1, COLLECT({ subObj1Id: subObj1.tildaid, subObj1Title: subObj1.title, pSubObj1: pSubObj1, label: labels(pSubObj1)[?], hdmpSubSubObjs: hdmpSubSubObjs, docs: opdocs2, changeLogCount: clog2Count, changeLogs: CASE WHEN lastClog2 IS NULL THEN [] ELSE [lastClog2] END, queryCount: query2Count }) AS pSubObjs WITH DISTINCT pa, a, pObj1, obj1Id, obj1Title, pSubObjs RETURN {pa:pa, a:a, pObj1:pObj1, obj1Id:obj1Id, obj1Title:obj1Title, pSubObjs:pSubObjs}
writeexecsvc
14
40 ms
650 ms
539 ms
flat
MATCH (dv:DocumentVersion {tildaid: $id})<-[:DOCUMENT_VERSION]-(d:Document) MATCH (r:Recommendation) WHERE r.doc_id = d.tildaid AND NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO…
MATCH (dv:DocumentVersion {tildaid: $id})<-[:DOCUMENT_VERSION]-(d:Document) MATCH (r:Recommendation) WHERE r.doc_id = d.tildaid AND NOT r.category IN [?, ?, ?] MATCH (ai:AIRun)-[:AI_RUN_TO_RECOMMENDATION]->(r) MATCH (r)-[:RECOMMENDATION_TO_ORGANIZATION]->(o:Organization) OPTIONAL MATCH (d)<-[:INCLUDES]-(currentFolder:Folder{folderType:?, delpending: FALSE}) WHERE currentFolder.scope IN [?, ?] OPTIONAL MATCH (d)-[:FILED_UNDER_SUBARTIFACT]->(currentSubArtifact:SubArtifact)<-[:INCLUDES]-(currentFolder) OPTIONAL MATCH (d)-[:HAS_STAGING_INFO]->(stagingInfo:DocumentStagingInfo) OPTIONAL MATCH (artifact:Folder{tildaid:coalesce(stagingInfo.folderId, currentFolder.tildaid, ?)})<-[:INCLUDES]-(section:Folder)<-[:INCLUDES]-(zone:Folder)<-[:INCLUDES]-(collection:Folder{level:?}) OPTIONAL MATCH (artifact)-[:INCLUDES]->(subArtifact:SubArtifact{tildaid:coalesce(stagingInfo.subArtifactId, currentSubArtifact.tildaid, ?)}) OPTIONAL MATCH (d) - [:UPLOADED_BY] - (u: User) OPTIONAL MATCH (d)<-[:INCLUDES]-(b:Binder)-[:BINDER_FOR]->(study:Study) OPTIONAL MATCH (d)<-[:INCLUDES]-(b2:Binder)-[:BINDER_FOR]->(site:Site) CALL { WITH d, site OPTIONAL MATCH (study:Study{tildaid: d.studyId})<-[:PLAN_DEFINITION_TO_STUDY]- (pd:DslPlanDefinition{delpending:false, type:?})-[:PLAN_DEFINITION_TO_SITE]->(site) RETURN COALESCE(pd.siteNumber, ?) AS siteNumber } CALL { WITH dv OPTIONAL MATCH (dv)<-[:DOCUMENT_SOURCE_TO_VERSION]-(ds:DocumentSource)-[:HAS_ATTRIBUTE]->(docAttr: DocAttribute) WITH collect([coalesce(docAttr.key, ?), coalesce(docAttr.value, ?)]) AS attributePairs WITH apoc.map.fromPairs(attributePairs) AS attributesMap With apoc.convert.toJson(attributesMap) AS attributesJson RETURN attributesJson } WITH r, ai, o, d, dv, zone, section, artifact, subArtifact, u, study, site, siteNumber, attributesJson, // Document Scope key stripping: reduce the rec JSON envelope to the keys // valid for its OWN scope so irrelevant keys (e.g. country on a site rec) // don?scope?country?scope?siteName?siteId?siteNumber?scope?scope???{}?{}?????{}?{?{?{????DRecommendation?t emit irrelevant rows (e.g. country on a site-scoped rec). recommendedValue: CASE WHEN r.category = ? AND recAllowed IS NOT NULL THEN apoc.convert.toJson(apoc.map.fromPairs([k IN keys(recMap) WHERE k IN recAllowed | [k, recMap[k]]])) ELSE coalesce(CASE WHEN coalesce(r.data_formatted, ?) <> ? THEN r.data_formatted END, r.data, ?) END, // originalRecommendation = the AI?Document Scope????Document Metadata?{}??Document Scope???Document Naming??TMF Artifact???.???.??? ??Sub Artifact??Document Scope??country???site?????Document Metadata??Document Metadata?????{}??????{}??{}??Document Scope?????country???site??????Document Naming???????TMF Artifact????????.???.??? ??Sub Artifact???????Document Format?Document Summary?Quality Control?PHI Issues?Confirm?Fix It????' } ) YIELD node RETURN node
writedashrsvc
15
35 ms
625 ms
516 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
16
53 ms
600 ms
798 ms
flat
MATCH (study:Study {tildaid: $studyId})-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE NOT EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) CALL { WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]…
MATCH (study:Study {tildaid: $studyId})-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE NOT EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) CALL { WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantControl)-[:PARTICIPANT_CONTROL]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw UNION ALL WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw } WITH DISTINCT study, t, ptc, pw MATCH (t)-[:BELONGS_TO]-(:Inbox)-[:MANAGED_BY]-(o:Organization) MATCH (ptc)-[:BELONGS_TO_TASKCONFIG]-(tc:TaskConfig) OPTIONAL MATCH (t)-[:BELONGS_TO]-(taskInbox:Inbox{type:?})--(taskUser:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:StudySiteActor)-[:STUDYSITEACTOR_TO_ACTOR]-(:Actor{delpending:false})-[:FOR_USER]-(user:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(scopeSite:Site)-[:SITE_TO_SMO]-(:Smo)-[:IS_AN_ORG]-(o) WITH DISTINCT study, t, o, tc, taskInbox, taskUser, user, scopeSite SKIP $skip LIMIT $limit WITH collect({study:study, t:t, o:o, tc:tc, taskInbox:taskInbox, taskUser:taskUser, user:user, scopeSite:scopeSite}) AS rows, collect(DISTINCT study) AS studies, collect(DISTINCT o) AS orgs, collect(DISTINCT scopeSite) AS sites CALL { WITH studies UNWIND studies AS study OPTIONAL MATCH (study)-[:STUDY_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(r:Role) WHERE r.name IN [?, ?, ?] RETURN study.tildaid AS studyId, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS piTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS smoTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS raTildaid } WITH rows, orgs, sites, collect({studyId: studyId, pi: piTildaid, smo: smoTildaid, ra: raTildaid}) AS studyRoles CALL { WITH orgs UNWIND orgs AS o OPTIONAL MATCH (o)-[:ORGANIZATION_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN o.tildaid AS orgId, collect(DISTINCT u.tildaid) AS adminTildaid } WITH rows, sites, studyRoles, collect({orgId: orgId, admin: adminTildaid}) AS orgRoles CALL { WITH sites UNWIND (CASE WHEN size(sites) = ? THEN [null] ELSE sites END) AS scopeSite OPTIONAL MATCH (scopeSite)-[:STAFF_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN scopeSite.tildaid AS siteId, collect(DISTINCT u.tildaid) AS siteAdminTildaid } WITH rows, studyRoles, orgRoles, collect({siteId: siteId, admin: siteAdminTildaid}) AS siteRoles UNWIND rows AS row WITH row, [x IN studyRoles WHERE x.studyId = row.study.tildaid][?] AS sr, [x IN orgRoles WHERE x.orgId = row.o.tildaid][?] AS orr, [x IN siteRoles WHERE row.scopeSite IS NOT NULL AND x.siteId = row.scopeSite.tildaid][?] AS str RETURN DISTINCT row.t AS task, apoc.convert.toJson({userTildaid: row.user.tildaid, userName: row.user.name, PITildaid: sr.pi, studyOwnerTildaid: sr.smo, regAnalystTildaid: sr.ra, orgAdminTildaid: orr.admin, studyName: row.study.name, siteName: row.scopeSite.name, siteAdminTildaid: CASE WHEN row.scopeSite IS NULL THEN [] ELSE str.admin END}) AS details, row.tc.who AS dsnWho, row.o.alias AS orgAlias, row.taskInbox, row.taskUser.tildaid AS taskUserId
tusker
18
50 ms
550 ms
871 ms
flat
// First part for StudySiteUser scope match (:StudySiteDuty)-[:STUDYSITEDUTY_TO_STUDYSITEACTOR]->(scopeUser:StudySiteActor{delpending:false}) with distinct scopeUser match (scopeUser)-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(sitePd:DslPlanDe…
// First part for StudySiteUser scope match (:StudySiteDuty)-[:STUDYSITEDUTY_TO_STUDYSITEACTOR]->(scopeUser:StudySiteActor{delpending:false}) with distinct scopeUser match (scopeUser)-[:STUDYSITEACTOR_TO_PLAN_DEFINITION]->(sitePd:DslPlanDefinition{type:?}) match (sitePd)-[:PLAN_DEFINITION_TO_ADOPTED_WORKFLOWS]->(w:WorkflowV2)<-[:TRIGGER_TO_WORKFLOW]-(t:Trigger{scope:?}) match (sitePd)-[:PLAN_DEFINITION_TO_STUDY]->(st:Study)-[:STUDY_TO_ORG]->(o:Organization{orgType:?}) match (sitePd)-[:PLAN_DEFINITION_TO_SITE]->(site:Site) match (scopeUser)-[:STUDYSITEACTOR_TO_ACTOR]->(actor:Actor{delpending:false})<-[:STUDY_TO_ACTOR]-(st) where not exists((scopeUser)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:ParticipantWorkflow)) return distinct scopeUser.tildaid as scopeTildaid, t.scope as workflowScope, st.tildaid as stId, o.alias as orgAlias, site.tildaid as siteId, scopeUser.roles as roles UNION // Second part for StudySite scope match (t:Trigger{scope:?})-[:TRIGGER_TO_WORKFLOW]->(w:WorkflowV2) match (w)<-[:PLAN_DEFINITION_TO_ADOPTED_WORKFLOWS]-(scopeSite:DslPlanDefinition{type:?}) where not exists((scopeSite)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:ParticipantWorkflow)) with distinct t.scope as workflowScope, scopeSite match (scopeSite)-[:PLAN_DEFINITION_TO_STUDY]->(st:Study)-[:STUDY_TO_ORG]->(o:Organization{orgType:?}) match (scopeSite)-[:PLAN_DEFINITION_TO_SITE]->(site:Site) return distinct scopeSite.tildaid as scopeTildaid, workflowScope, st.tildaid as stId, o.alias as orgAlias, site.tildaid as siteId, null as roles
regsvc
19
32 ms
525 ms
584 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
38
32 ms
525 ms
579 ms
flat
MATCH (u:User) WHERE u.tildaid IN $userIds AND u.status<>?OPTIONAL MATCH (u)-[:INTERNAL_DATA]-(ui:UserInternal) WITH u, COALESCE(ui.pinHash IS NOT NULL AND ui.pinHash <> ?, false) AS pinSet, COALESCE(ui.needs2Factor, false) AS needs2Factor…
MATCH (u:User) WHERE u.tildaid IN $userIds AND u.status<>?OPTIONAL MATCH (u)-[:INTERNAL_DATA]-(ui:UserInternal) WITH u, COALESCE(ui.pinHash IS NOT NULL AND ui.pinHash <> ?, false) AS pinSet, COALESCE(ui.needs2Factor, false) AS needs2Factor WITH u, u{.*, pinSet: pinSet, needs2Factor: needs2Factor} as profile CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization{tildaid:$orgId, delpending:false}) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, a, r order by r.displayName WITH u, o, a, apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, orgType: o.orgType, status: o.status, startDate: a.startDate, endDate: a.endDate, capabilities: u.capabilities, role: roles, displayRoles: displayRoles, logoDocumentId: o.logoDocumentId, theme: o.theme, logoURL: o.logoURL, pinCheckEnabled: o.pinCheckEnabled }) AS organizations } CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false,orgId:$orgId})<-[:STUDY_TO_ACTOR]-(s:Study{delpending:false}) WITH DISTINCT s, a, u.capabilities AS caps CALL { WITH a OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH r order by r.displayName RETURN apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles } MATCH (s)-[:STUDY_TO_ORG]->(o:Organization{tildaid:$orgId, delpending:false}) // DISTINCT restores the dedup the old (u,o,s,a) grouping gave for free: two parallel // STUDY_TO_ORG edges would otherwise emit the study twice. The ORDER BY makes the // studies array a stable sequence for clients rather than a plan-dependent one. WITH DISTINCT s, a, caps, roles, displayRoles, o ORDER BY s.name, s.tildaid, o.tildaid RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, studyName: s.name, studySponsor: s.sponsor, studyId: s.tildaid, startDate: a.startDate, endDate: a.endDate, capabilities: caps, iSBlinded: a.isBlinded, role: roles, displayRoles: displayRoles }) AS studies } CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:STAFF_TO_ACTOR]-(si:Site{delpending:false})-[:SITE_TO_SMO]->(:Smo)-[:IS_AN_ORG]->(o:Organization{tildaid:$orgId, delpending:false}) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, si, a, r order by r.displayName WITH u, o, si, a, apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, siteId: si.tildaid, siteName: si.name, siteCity: si.city, contactPhone: si.contactPhone, contactEmail: si.contactEmail, defaultLanguage: si.defaultLanguage, role: roles, displayRoles: displayRoles }) as sites } return profile{.*, organizations: organizations, studies: studies, sites: sites}
tusker
1
412 ms
485 ms
412 ms
flat
MATCH (u:User) WHERE u.tildaid IN $userIds AND u.status<>?OPTIONAL MATCH (u)-[:INTERNAL_DATA]-(ui:UserInternal) WITH u, COALESCE(ui.pinHash IS NOT NULL AND ui.pinHash <> ?, false) AS pinSet, COALESCE(ui.needs2Factor, false) AS needs2Factor…
MATCH (u:User) WHERE u.tildaid IN $userIds AND u.status<>?OPTIONAL MATCH (u)-[:INTERNAL_DATA]-(ui:UserInternal) WITH u, COALESCE(ui.pinHash IS NOT NULL AND ui.pinHash <> ?, false) AS pinSet, COALESCE(ui.needs2Factor, false) AS needs2Factor WITH u, u{.*, pinSet: pinSet, needs2Factor: needs2Factor} as profile CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization{tildaid:$orgId, delpending:false}) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, a, r order by r.displayName WITH u, o, a, apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, orgType: o.orgType, status: o.status, startDate: a.startDate, endDate: a.endDate, capabilities: u.capabilities, role: roles, displayRoles: displayRoles, logoDocumentId: o.logoDocumentId, theme: o.theme, logoURL: o.logoURL, pinCheckEnabled: o.pinCheckEnabled }) AS organizations } CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false,orgId:$orgId})<-[:STUDY_TO_ACTOR]-(s:Study{delpending:false}) WITH DISTINCT s, a, u.capabilities AS caps CALL { WITH a OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH r order by r.displayName RETURN apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles } MATCH (s)-[:STUDY_TO_ORG]->(o:Organization{tildaid:$orgId, delpending:false}) // DISTINCT restores the dedup the old (u,o,s,a) grouping gave for free: two parallel // STUDY_TO_ORG edges would otherwise emit the study twice. The ORDER BY makes the // studies array a stable sequence for clients rather than a plan-dependent one. WITH DISTINCT s, a, caps, roles, displayRoles, o ORDER BY s.name, s.tildaid, o.tildaid RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, studyName: s.name, studySponsor: s.sponsor, studyId: s.tildaid, startDate: a.startDate, endDate: a.endDate, capabilities: caps, iSBlinded: a.isBlinded, role: roles, displayRoles: displayRoles }) AS studies } CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:STAFF_TO_ACTOR]-(si:Site{delpending:false})-[:SITE_TO_SMO]->(:Smo)-[:IS_AN_ORG]->(o:Organization{tildaid:$orgId, delpending:false}) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, si, a, r order by r.displayName WITH u, o, si, a, apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, siteId: si.tildaid, siteName: si.name, siteCity: si.city, contactPhone: si.contactPhone, contactEmail: si.contactEmail, defaultLanguage: si.defaultLanguage, role: roles, displayRoles: displayRoles }) as sites } return profile{.*, organizations: organizations, studies: studies, sites: sites}
schedsvc
1
376 ms
485 ms
376 ms
flat
MATCH (p:Policy)-[:IS_ASSIGNED_TO]->(r:Role) WHERE coalesce(p.state, ?) IN [?, ?] OPTIONAL MATCH (r)<-[:MIMICS]-(m:Role) OPTIONAL MATCH (p)-[:APPLICABLE_IN]->(s:Scope {version:$scopeVersion}) UNWIND [r.name, m.name] as roleName WITH p, s, …
MATCH (p:Policy)-[:IS_ASSIGNED_TO]->(r:Role) WHERE coalesce(p.state, ?) IN [?, ?] OPTIONAL MATCH (r)<-[:MIMICS]-(m:Role) OPTIONAL MATCH (p)-[:APPLICABLE_IN]->(s:Scope {version:$scopeVersion}) UNWIND [r.name, m.name] as roleName WITH p, s, apoc.text.join(collect(DISTINCT roleName), ?) as roleList RETURN { name: p.name, roleList: roleList, objectTypeList: p.objectTypeList, allowedOps: p.allowedOps, scope: s.name } as policy
rag-agent
2
340 ms
485 ms
340 ms
flat
MATCH (b:Budget)-[:BUDGET_TO_ORG]->(o:Organization {alias: $orgAlias}) WHERE b.studyId IN $filterStudyIds WITH b.name AS name, b, CASE b.status WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? ELSE ? END AS statusPriority WITH name,…
MATCH (b:Budget)-[:BUDGET_TO_ORG]->(o:Organization {alias: $orgAlias}) WHERE b.studyId IN $filterStudyIds WITH b.name AS name, b, CASE b.status WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? ELSE ? END AS statusPriority WITH name, b, statusPriority ORDER BY name, statusPriority WITH name, collect(b) AS budgetsPerGroup WITH name, budgetsPerGroup[?] AS b ORDER BY b.createdat DESC WITH collect(b) AS budgetList WITH budgetList, size(budgetList) AS totalCount WITH budgetList[$pageSkip..$pageEnd] AS paginatedBudgets, totalCount UNWIND paginatedBudgets AS b OPTIONAL MATCH (u:User {tildaid: b.configuredBy}) OPTIONAL MATCH (b)-[:BUDGET_TO_SITE|BUDGET_TO_SITE_DRAFT]->(site:Site) OPTIONAL MATCH (b)-[:BUDGET_TO_STUDY]->(study:Study) // Fetch linked budgets OPTIONAL MATCH (b)-[:BUDGET_TO_BUDGET*?..]-(linkedBudget:Budget) WHERE linkedBudget.tildaid <> b.tildaid WITH b, totalCount, u, collect(DISTINCT site) as sites, study, collect(linkedBudget) as tempLinkedBudgets // Handle linked budgets info collection WITH b, totalCount, u, sites, study, [budget IN tempLinkedBudgets | { budget: budget, sites: [(budget)-[:BUDGET_TO_SITE|BUDGET_TO_SITE_DRAFT]->(s2:Site) | s2], linkedUser: head([linkedUser IN [(budget)<-[:CONFIGURED_BY]-(u2:User) | u2] | linkedUser]), statusPriority: CASE budget.status WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? ELSE ? END }] as linkedBudgetsInfo // Sort linked budgets safely by handling empty collections WITH b, totalCount, u, sites, study, CASE WHEN size(linkedBudgetsInfo) > ? THEN apoc.coll.sortMulti( linkedBudgetsInfo, [?, ?] ) ELSE [] END as linkedBudgetsInfo // Final collection of data for node creation WITH b, u, sites, study.name AS studyName, study.sponsor AS sponsor, u.name AS configuredByName, totalCount, linkedBudgetsInfo CALL apoc.create.vNode( [?], { tildaid: b.tildaid, createdat: b.createdat, updatedat: b.updatedat, orgAlias: b.orgAlias, name: b.name, studyId: b.studyId, protocolVersionId: b.protocolVersionId, effectiveDate: b.effectiveDate, type: b.type, version: b.version, status: b.status, configuredBy: b.configuredBy, sourceBudgetId: b.sourceBudgetId, screenFailureRatioScreenFailed: b.screenFailureRatioScreenFailed, screenFailureRatioEnrolled: b.screenFailureRatioEnrolled, screenFailureAllowance: b.screenFailureAllowance, screenFailureCalculationMode: b.screenFailureCalculationMode, siteInfo: [site IN sites | { id: site.tildaid, name: site.name }], studyName: studyName, sponsor: sponsor, configuredByName: configuredByName, budgetVersions: [info IN linkedBudgetsInfo | { tildaid: info.budget.tildaid, createdat: info.budget.createdat, updatedat: info.budget.updatedat, orgAlias: info.budget.orgAlias, name: info.budget.name, studyId: info.budget.studyId, protocolVersionId: info.budget.protocolVersionId, effectiveDate: info.budget.effectiveDate, type: info.budget.type, version: info.budget.version, status: info.budget.status, configuredBy: info.budget.configuredBy, sourceBudgetId: info.budget.sourceBudgetId, screenFailureRatioScreenFailed: info.budget.screenFailureRatioScreenFailed, screenFailureRatioEnrolled: info.budget.screenFailureRatioEnrolled, screenFailureAllowance: info.budget.screenFailureAllowance, screenFailureCalculationMode: info.budget.screenFailureCalculationMode, error: info.budget.error, studyName: info.study.name, sponsor: info.study.sponsor, configuredByName: info.user.name, siteInfo: [site IN info.sites | { id: site.tildaid, name: site.name }] }] } ) YIELD node AS budgetNode RETURN budgetNode, totalCount
writefinsvc
1
248 ms
485 ms
248 ms
flat
match(a:FormV2{tildaid:$formId})-[r:GRAPH_NEXT*?..{graphid:$formId, path:[$formId]}]->(b) with r[-?] as rel, b match(prev:GraphNode)-[:GRAPH_NEXT{graphid:$formId, path:[$formId]}]->(b) with b, rel, prev optional match(b)-[]-(qs:QuestionSpe…
match(a:FormV2{tildaid:$formId})-[r:GRAPH_NEXT*?..{graphid:$formId, path:[$formId]}]->(b) with r[-?] as rel, b match(prev:GraphNode)-[:GRAPH_NEXT{graphid:$formId, path:[$formId]}]->(b) with b, rel, prev optional match(b)-[]-(qs:QuestionSpec)-[]-(q:QuestionV2) optional match(b)-[rb:BRANCH_TO_BRANCH_CONFIG{graphid:$formId}]-(cfg:BranchConfig) where rb.protocolid=$protocolId with * optional match(b)-[:ACTION_TO_ACTION_CONFIG{graphid:$formId}]->(actionCfg:ActionConfig) with * optional match(b)-[:GRAPH_NODE_REF_TO_GRAPH_NODE{protocolid:$protocolId}]->(refObj:GraphNode) optional match(b)-[:QUESTION_TO_AUTO_COMPUTE_CFG{graphid:$formId, protocolid:$protocolId}]->(acCfg:AutoComputeConfig) optional match(b)-[:QUESTION_TO_CORRECTNESS_CHECK{graphid:$formId, protocolid:$protocolId}]->(ccCfg:AutoComputeConfig) optional match(b)-[:GRAPH_NODE_REF_TO_QUESTION|GRAPH_NODE_REF_TO_GRAPH_NODE{protocolid:$protocolId}]->(q2:QuestionV2) optional match(b)-[:GRAPH_NODE_REF_TO_GRAPH_NODE{protocolid:$protocolId}]->(rs:ResponseSet) optional match(q2)-[:QUESTION_TO_QUESTION_SPEC]->(q2qs:QuestionSpec) optional match(rs)<-[:QUESTION_SPEC_TO_RESPONSE_SET]-(rsqs:QuestionSpec) with *, null as acBranchCfg, null as ccBranchCfg with *, ? as refCount optional match(b)-[:GRAPH_NODE_TO_ACTIVATION_RULE_CHAIN{graphid:$formId}]->(chain:ActivationRuleChain) with refCount, b, rel, prev, q, qs, cfg, actionCfg, refObj, acCfg, q2, q2qs, rs, rsqs, acBranchCfg, ccCfg, ccBranchCfg, chain return distinct b, rel, prev.tildaid, q, exists((b)<-[:GRAPH_NEXT|FORM_INSTANCE_TO_FORM]-()), cfg, actionCfg, refObj, acCfg, q2, rs, refCount, acBranchCfg, ccCfg, ccBranchCfg, chain.tildaid, chain.name, qs, q2qs, rsqs
studiosvc
1
485 ms
485 ms
485 ms
flat
p95 drift compares the query's p95 in the recent half of the window to the earlier half — ≥1.2×
means it's slowing down. Click a row for its p50/p95 latency trend over time. Latency percentiles come from
per-bucket histograms (no individual queries stored).