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
stored27h agotop 80 of 1,272
Neo4j query shapes on delta 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 (qn {tildaid:?}) OPTIONAL MATCH (qn)<-[:GRAPH_NODE_REF_TO_QUESTION]-(ref:GraphNodeRef)<-[g:GRAPH_NEXT]-(parent) RETURN labels(qn) AS labels, qn.title AS title, qn.variablename AS var, qn.deltimestamp AS del, collect(DISTINCT [labels(…
MATCH (qn {tildaid:?}) OPTIONAL MATCH (qn)<-[:GRAPH_NODE_REF_TO_QUESTION]-(ref:GraphNodeRef)<-[g:GRAPH_NEXT]-(parent) RETURN labels(qn) AS labels, qn.title AS title, qn.variablename AS var, qn.deltimestamp AS del, collect(DISTINCT [labels(parent), parent.title, g.protocolid])[?..?] AS placements
(internal)
1
2.3 min
≥ 2.0 min
2.3 min
flat
with $protocolId as protocolId, $careplanId as careplanId, $visitRefId as visitRefId, $activityRefId as activityRefId, $pvId as pvId, null as pwId, $paId as paId, $pqnrId as pqnrId, null as ptId, $hdmClassId as hdmClassId call(careplanId, …
with $protocolId as protocolId, $careplanId as careplanId, $visitRefId as visitRefId, $activityRefId as activityRefId, $pvId as pvId, null as pwId, $paId as paId, $pqnrId as pqnrId, null as ptId, $hdmClassId as hdmClassId call(careplanId, protocolId, pwId, pvId, paId, pqnrId, ptId, hdmClassId) { match (vref:GraphNodeRef{tildaid:?})-[rv:GRAPH_NODE_REF_TO_GRAPH_NODE]->(v:VisitV2)-[:BELONGS_TO_VISIT]-(pv:ParticipantVisit{carePlanId:careplanId}) match (aref:GraphNodeRef{tildaid:?})-[ra:GRAPH_NODE_REF_TO_GRAPH_NODE]->(a:ActivityV2)-[:BELONGS_TO_ACTIVITY]-(pa:ParticipantActivity{carePlanId:careplanId}) match (qref:GraphNodeRef{tildaid:?})-[rq:GRAPH_NODE_REF_TO_GRAPH_NODE]->(q:QuestionnaireV2)-[:BELONGS_TO_QUESTIONNAIRE]-(pqnr:ParticipantQuestionnaire{carePlanId:careplanId}) match(ref:GraphNodeRef{tildaid:?})-[rpq:GRAPH_NODE_REF_TO_GRAPH_NODE|GRAPH_NODE_REF_TO_QUESTION] ->(qn:QuestionV2)-[:BELONGS_TO_QUESTION]-(pqn:ParticipantQuestion{carePlanId:careplanId, hdmClassId:hdmClassId})-[:PARTICIPANT_QUESTION]-(pqnr)-[:PARTICIPANT_QUESTIONNAIRE]-(pa)-[:PARTICIPANT_ACTIVITY]-(pv)-[:CAREPLAN_TO_ALL_PARTICIPANTVISITS]-(cp:CarePlan{tildaid:careplanId}) with case when pqn.editStatus = ? then {v: pqn.editValue, l: pqn.editValues} else {v: pqn.value, l: pqn.values} end as pqnAns with case when size(coalesce(pqnAns.l, [])) > ? and apoc.text.join(pqnAns.l, ?) = coalesce(pqnAns.v, ?) then pqnAns.l when coalesce(pqnAns.v, ?) = ? then [] else apoc.coll.toSet(split(pqnAns.v, ?) + [pqnAns.v]) end as pqnValues return distinct pqnValues as ans1 } call(careplanId, protocolId, pwId, pvId, paId, pqnrId, ptId, hdmClassId) { match(ref:GraphNodeRef{tildaid:?})-[rpq:GRAPH_NODE_REF_TO_GRAPH_NODE|GRAPH_NODE_REF_TO_QUESTION] ->(qn:QuestionV2)-[:BELONGS_TO_QUESTION]-(pqn:ParticipantQuestion{carePlanId:careplanId, hdmClassId:hdmClassId})-[:PARTICIPANT_QUESTION]-(pqnr:ParticipantQuestionnaire{tildaid:pqnrId}) with case when pqn.editStatus = ? then {v: pqn.editValue, l: pqn.editValues} else {v: pqn.value, l: pqn.values} end as pqnAns with case when size(coalesce(pqnAns.l, [])) > ? and apoc.text.join(pqnAns.l, ?) = coalesce(pqnAns.v, ?) then pqnAns.l when coalesce(pqnAns.v, ?) = ? then [] else apoc.coll.toSet(split(pqnAns.v, ?) + [pqnAns.v]) end as pqnValues return distinct pqnValues as ans2 } return ((( size(apoc.coll.intersection(apoc.coll.sort(ans1), apoc.coll.sort(ans2))) > ?)))
execsvc
8,450
14.90 s
1.4 min
2.1 min
flat
with $protocolId as protocolId, $careplanId as careplanId, $visitRefId as visitRefId, $activityRefId as activityRefId, $pvId as pvId, null as pwId, $paId as paId, $pqnrId as pqnrId, null as ptId, $hdmClassId as hdmClassId call(careplanId, …
with $protocolId as protocolId, $careplanId as careplanId, $visitRefId as visitRefId, $activityRefId as activityRefId, $pvId as pvId, null as pwId, $paId as paId, $pqnrId as pqnrId, null as ptId, $hdmClassId as hdmClassId call(careplanId, protocolId, pwId, pvId, paId, pqnrId, ptId, hdmClassId) { match (vref:GraphNodeRef{tildaid:?})-[rv:GRAPH_NODE_REF_TO_GRAPH_NODE]->(v:VisitV2)-[:BELONGS_TO_VISIT]-(pv:ParticipantVisit{carePlanId:careplanId}) match (aref:GraphNodeRef{tildaid:?})-[ra:GRAPH_NODE_REF_TO_GRAPH_NODE]->(a:ActivityV2)-[:BELONGS_TO_ACTIVITY]-(pa:ParticipantActivity{carePlanId:careplanId}) match (qref:GraphNodeRef{tildaid:?})-[rq:GRAPH_NODE_REF_TO_GRAPH_NODE]->(q:QuestionnaireV2)-[:BELONGS_TO_QUESTIONNAIRE]-(pqnr:ParticipantQuestionnaire{carePlanId:careplanId}) match(ref:GraphNodeRef{tildaid:?})-[rpq:GRAPH_NODE_REF_TO_GRAPH_NODE|GRAPH_NODE_REF_TO_QUESTION] ->(qn:QuestionV2)-[:BELONGS_TO_QUESTION]-(pqn:ParticipantQuestion{carePlanId:careplanId, hdmClassId:hdmClassId})-[:PARTICIPANT_QUESTION]-(pqnr)-[:PARTICIPANT_QUESTIONNAIRE]-(pa)-[:PARTICIPANT_ACTIVITY]-(pv)-[:CAREPLAN_TO_ALL_PARTICIPANTVISITS]-(cp:CarePlan{tildaid:careplanId}) with case when pqn.editStatus = ? then {v: pqn.editValue, l: pqn.editValues} else {v: pqn.value, l: pqn.values} end as pqnAns with case when size(coalesce(pqnAns.l, [])) > ? and apoc.text.join(pqnAns.l, ?) = coalesce(pqnAns.v, ?) then pqnAns.l when coalesce(pqnAns.v, ?) = ? then [] else apoc.coll.toSet(split(pqnAns.v, ?) + [pqnAns.v]) end as pqnValues return distinct pqnValues as ans1 } call(careplanId, protocolId, pwId, pvId, paId, pqnrId, ptId, hdmClassId) { match(ref:GraphNodeRef{tildaid:?})-[rpq:GRAPH_NODE_REF_TO_GRAPH_NODE|GRAPH_NODE_REF_TO_QUESTION] ->(qn:QuestionV2)-[:BELONGS_TO_QUESTION]-(pqn:ParticipantQuestion{carePlanId:careplanId, hdmClassId:hdmClassId})-[:PARTICIPANT_QUESTION]-(pqnr:ParticipantQuestionnaire{tildaid:pqnrId}) with case when pqn.editStatus = ? then {v: pqn.editValue, l: pqn.editValues} else {v: pqn.value, l: pqn.values} end as pqnAns with case when size(coalesce(pqnAns.l, [])) > ? and apoc.text.join(pqnAns.l, ?) = coalesce(pqnAns.v, ?) then pqnAns.l when coalesce(pqnAns.v, ?) = ? then [] else apoc.coll.toSet(split(pqnAns.v, ?) + [pqnAns.v]) end as pqnValues return distinct pqnValues as ans2 } return ((( size(apoc.coll.intersection(apoc.coll.sort(ans1), apoc.coll.sort(ans2))) > ?)))
execsvc
1,384
13.30 s
1.4 min
1.5 min
flat
MATCH (d:DocumentVersion) SET d.url = replace(d.url, ?, ?)
MATCH (d:DocumentVersion) SET d.url = replace(d.url, ?, ?)
write(internal)
1
57.39 s
58.50 s
57.39 s
flat
MATCH (u:User) WHERE u.email = ? AND u.deltimestamp = ? WITH collect(u) AS us, collect(u.tildaid) AS ids CALL (us) { UNWIND us AS u MATCH (t:Task)-[:CREATED_BY]->(u) RETURN count(t) AS tasks } CALL (ids) { MATCH (cl:ChangeLog) WHERE cl.cha…
MATCH (u:User) WHERE u.email = ? AND u.deltimestamp = ? WITH collect(u) AS us, collect(u.tildaid) AS ids CALL (us) { UNWIND us AS u MATCH (t:Task)-[:CREATED_BY]->(u) RETURN count(t) AS tasks } CALL (ids) { MATCH (cl:ChangeLog) WHERE cl.changedBy IN ids RETURN count(cl) AS changeLogs, count(DISTINCT cl.changedBy) AS distinctUsers } RETURN size(ids) AS emptyEmailUsers, tasks, changeLogs, distinctUsers
(internal)
1
31.52 s
58.50 s
31.52 s
flat
CALL { MATCH (d:Document) WHERE d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? // Certification is what triggers processing, so anything not yet certified // ha…
CALL { MATCH (d:Document) WHERE d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? // Certification is what triggers processing, so anything not yet certified // has not reached its trigger: a ZIP member still being extracted, or an // upload whose file has not landed. Starting one here races the writer // that will certify it. AND d.status = $certified_status AND NOT EXISTS { (d)<-[:AI_RUN_TO_DOCUMENT_LATEST]-(:AIRun) } RETURN d, null AS latest_ai UNION MATCH (ai:AIRun)-[:AI_RUN_TO_DOCUMENT_LATEST]->(d:Document) WHERE ai.status IN [?, ?] AND d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? AND d.status IN $retry_statuses WITH DISTINCT d MATCH (d)<-[:AI_RUN_TO_DOCUMENT_LATEST]-(run:AIRun) WITH d, run ORDER BY COALESCE(run.updatedat, run.createdat) DESC WITH d, collect(run)[?] AS latest_ai // The cap applies to both statuses: each backlog retry bumps auto_retry_count on // the run (and refreshes updatedat, which keeps an aborted run inside the adopt // path?Staging?Pre-Staging'] } MATCH (d)-[:DOC_TO_ORG]-(o:Organization{orgType:?}) WITH DISTINCT d, o, latest_ai WITH d.tildaid AS doc_id, o.tildaid AS org_id, o.alias AS org_alias, d.primaryVersionId AS version_id, d.studyId AS study_id, COALESCE(latest_ai.auto_retry_count, ?) AS current_retry_count, // null when latest_ai IS NULL — a document enabled but never run has no // originating request to recover, and a sentinel user is the honest answer there. latest_ai.request_info AS request_info, latest_ai.tildaid AS ai_run_id, d OPTIONAL MATCH (d)-[:UPLOADED_BY]->(uploader:User) WITH doc_id, org_id, org_alias, version_id, study_id, current_retry_count, request_info, ai_run_id, head(collect(uploader.email)) AS uploaded_by RETURN doc_id, org_id, org_alias, version_id, study_id, current_retry_count, request_info, ai_run_id, uploaded_by ORDER BY doc_id LIMIT $limit
docproc
2
27.86 s
57.00 s
54.82 s
flat
CALL { MATCH (d:Document) WHERE d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? // Certification is what triggers processing, so anything not yet certified // ha…
CALL { MATCH (d:Document) WHERE d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? // Certification is what triggers processing, so anything not yet certified // has not reached its trigger: a ZIP member still being extracted, or an // upload whose file has not landed. Starting one here races the writer // that will certify it. AND d.status = $certified_status AND NOT EXISTS { (d)<-[:AI_RUN_TO_DOCUMENT_LATEST]-(:AIRun) } RETURN d, null AS latest_ai UNION MATCH (ai:AIRun)-[:AI_RUN_TO_DOCUMENT_LATEST]->(d:Document) WHERE ai.status IN [?, ?] AND d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? AND d.status IN $retry_statuses WITH DISTINCT d MATCH (d)<-[:AI_RUN_TO_DOCUMENT_LATEST]-(run:AIRun) WITH d, run ORDER BY COALESCE(run.updatedat, run.createdat) DESC WITH d, collect(run)[?] AS latest_ai // The cap applies to both statuses: each backlog retry bumps auto_retry_count on // the run (and refreshes updatedat, which keeps an aborted run inside the adopt // path?Staging?Pre-Staging'] } MATCH (d)-[:DOC_TO_ORG]-(o:Organization{orgType:?}) WITH DISTINCT d, o, latest_ai WITH d RETURN count(d) AS total
docproc
3
18.88 s
55.50 s
54.81 s
flat
with $protocolId as protocolId, $careplanId as careplanId, $visitRefId as visitRefId, $activityRefId as activityRefId, $pvId as pvId, null as pwId, $paId as paId, $pqnrId as pqnrId, null as ptId, $hdmClassId as hdmClassId call(careplanId, …
with $protocolId as protocolId, $careplanId as careplanId, $visitRefId as visitRefId, $activityRefId as activityRefId, $pvId as pvId, null as pwId, $paId as paId, $pqnrId as pqnrId, null as ptId, $hdmClassId as hdmClassId call(careplanId, protocolId, pwId, pvId, paId, pqnrId, ptId, hdmClassId) { match (vref:GraphNodeRef{tildaid:?})-[rv:GRAPH_NODE_REF_TO_GRAPH_NODE]->(v:VisitV2)-[:BELONGS_TO_VISIT]-(pv:ParticipantVisit{carePlanId:careplanId}) match (aref:GraphNodeRef{tildaid:?})-[ra:GRAPH_NODE_REF_TO_GRAPH_NODE]->(a:ActivityV2)-[:BELONGS_TO_ACTIVITY]-(pa:ParticipantActivity{carePlanId:careplanId}) match (qref:GraphNodeRef{tildaid:?})-[rq:GRAPH_NODE_REF_TO_GRAPH_NODE]->(q:QuestionnaireV2)-[:BELONGS_TO_QUESTIONNAIRE]-(pqnr:ParticipantQuestionnaire{carePlanId:careplanId}) match(ref:GraphNodeRef{tildaid:?})-[rpq:GRAPH_NODE_REF_TO_GRAPH_NODE|GRAPH_NODE_REF_TO_QUESTION] ->(qn:QuestionV2)-[:BELONGS_TO_QUESTION]-(pqn:ParticipantQuestion{carePlanId:careplanId, hdmClassId:hdmClassId})-[:PARTICIPANT_QUESTION]-(pqnr)-[:PARTICIPANT_QUESTIONNAIRE]-(pa)-[:PARTICIPANT_ACTIVITY]-(pv)-[:CAREPLAN_TO_ALL_PARTICIPANTVISITS]-(cp:CarePlan{tildaid:careplanId}) with case when pqn.editStatus = ? then {v: pqn.editValue, l: pqn.editValues} else {v: pqn.value, l: pqn.values} end as pqnAns with case when size(coalesce(pqnAns.l, [])) > ? and apoc.text.join(pqnAns.l, ?) = coalesce(pqnAns.v, ?) then pqnAns.l when coalesce(pqnAns.v, ?) = ? then [] else apoc.coll.toSet(split(pqnAns.v, ?) + [pqnAns.v]) end as pqnValues return distinct pqnValues as ans1 } call(careplanId, protocolId, pwId, pvId, paId, pqnrId, ptId, hdmClassId) { match(ref:GraphNodeRef{tildaid:?})-[rpq:GRAPH_NODE_REF_TO_GRAPH_NODE|GRAPH_NODE_REF_TO_QUESTION] ->(qn:QuestionV2)-[:BELONGS_TO_QUESTION]-(pqn:ParticipantQuestion{carePlanId:careplanId, hdmClassId:hdmClassId})-[:PARTICIPANT_QUESTION]-(pqnr:ParticipantQuestionnaire{tildaid:pqnrId}) with case when pqn.editStatus = ? then {v: pqn.editValue, l: pqn.editValues} else {v: pqn.value, l: pqn.values} end as pqnAns with case when size(coalesce(pqnAns.l, [])) > ? and apoc.text.join(pqnAns.l, ?) = coalesce(pqnAns.v, ?) then pqnAns.l when coalesce(pqnAns.v, ?) = ? then [] else apoc.coll.toSet(split(pqnAns.v, ?) + [pqnAns.v]) end as pqnValues return distinct pqnValues as ans2 } return ((( size(apoc.coll.intersection(apoc.coll.sort(ans1), apoc.coll.sort(ans2))) > ?)))
CALL { MATCH (d:Document) WHERE d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? // Certification is what triggers processing, so anything not yet certified // ha…
CALL { MATCH (d:Document) WHERE d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? // Certification is what triggers processing, so anything not yet certified // has not reached its trigger: a ZIP member still being extracted, or an // upload whose file has not landed. Starting one here races the writer // that will certify it. AND d.status = $certified_status AND NOT EXISTS { (d)<-[:AI_RUN_TO_DOCUMENT_LATEST]-(:AIRun) } RETURN d, null AS latest_ai UNION MATCH (ai:AIRun)-[:AI_RUN_TO_DOCUMENT_LATEST]->(d:Document) WHERE ai.status IN [?, ?] AND d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? AND d.status IN $retry_statuses WITH DISTINCT d MATCH (d)<-[:AI_RUN_TO_DOCUMENT_LATEST]-(run:AIRun) WITH d, run ORDER BY COALESCE(run.updatedat, run.createdat) DESC WITH d, collect(run)[?] AS latest_ai // The cap applies to both statuses: each backlog retry bumps auto_retry_count on // the run (and refreshes updatedat, which keeps an aborted run inside the adopt // path?Staging?Pre-Staging'] } MATCH (d)-[:DOC_TO_ORG]-(o:Organization{orgType:?}) WITH DISTINCT d, o, latest_ai WITH d RETURN count(d) AS total
docproc
10
4.97 s
45.00 s
41.10 s
flat
MATCH (d:Document)-[:DOCUMENT_VERSION]->(ver:DocumentVersion {status: $pending}) WHERE ver.createdat <= $cutoff RETURN d.tildaid, ver.tildaid ORDER BY ver.createdat LIMIT $limit
MATCH (d:Document)-[:DOCUMENT_VERSION]->(ver:DocumentVersion {status: $pending}) WHERE ver.createdat <= $cutoff RETURN d.tildaid, ver.tildaid ORDER BY ver.createdat LIMIT $limit
docsvc
10
3.93 s
45.00 s
37.15 s
flat
MATCH (pt:ParticipantTable)-[:PARTICIPANT_QUESTION]->(pq:ParticipantQuestion) WHERE pq.hdmClassId IN [?,?] MATCH (qn:QuestionV2 {tildaid: pq.questionId}) RETURN pq.hdmClassId AS row, qn.title AS question, pq.value AS value, pq.status AS st…
MATCH (pt:ParticipantTable)-[:PARTICIPANT_QUESTION]->(pq:ParticipantQuestion) WHERE pq.hdmClassId IN [?,?] MATCH (qn:QuestionV2 {tildaid: pq.questionId}) RETURN pq.hdmClassId AS row, qn.title AS question, pq.value AS value, pq.status AS status, EXISTS { (qn)<-[:GRAPH_NODE_REF_TO_QUESTION]-(:GraphNodeRef) } AS inAnyForm, datetime({epochMillis: qn.updatedat}) AS qnUpdated ORDER BY row, question
(internal)
1
22.00 s
29.50 s
22.00 s
flat
CALL { MATCH (d:Document) WHERE d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? // Certification is what triggers processing, so anything not yet certified // ha…
CALL { MATCH (d:Document) WHERE d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? // Certification is what triggers processing, so anything not yet certified // has not reached its trigger: a ZIP member still being extracted, or an // upload whose file has not landed. Starting one here races the writer // that will certify it. AND d.status = $certified_status AND NOT EXISTS { (d)<-[:AI_RUN_TO_DOCUMENT_LATEST]-(:AIRun) } RETURN d, null AS latest_ai UNION MATCH (ai:AIRun)-[:AI_RUN_TO_DOCUMENT_LATEST]->(d:Document) WHERE ai.status IN [?, ?] AND d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? AND d.status IN $retry_statuses WITH DISTINCT d MATCH (d)<-[:AI_RUN_TO_DOCUMENT_LATEST]-(run:AIRun) WITH d, run ORDER BY COALESCE(run.updatedat, run.createdat) DESC WITH d, collect(run)[?] AS latest_ai // The cap applies to both statuses: each backlog retry bumps auto_retry_count on // the run (and refreshes updatedat, which keeps an aborted run inside the adopt // path?Staging?Pre-Staging'] } MATCH (d)-[:DOC_TO_ORG]-(o:Organization{orgType:?}) WITH DISTINCT d, o, latest_ai WITH d.tildaid AS doc_id, o.tildaid AS org_id, o.alias AS org_alias, d.primaryVersionId AS version_id, d.studyId AS study_id, COALESCE(latest_ai.auto_retry_count, ?) AS current_retry_count, // null when latest_ai IS NULL — a document enabled but never run has no // originating request to recover, and a sentinel user is the honest answer there. latest_ai.request_info AS request_info, latest_ai.tildaid AS ai_run_id, d OPTIONAL MATCH (d)-[:UPLOADED_BY]->(uploader:User) WITH doc_id, org_id, org_alias, version_id, study_id, current_retry_count, request_info, ai_run_id, head(collect(uploader.email)) AS uploaded_by RETURN doc_id, org_id, org_alias, version_id, study_id, current_retry_count, request_info, ai_run_id, uploaded_by ORDER BY doc_id LIMIT $limit
docproc
10
3.09 s
25.00 s
22.30 s
flat
MATCH (cp:CarePlan) WHERE cp.tildaid > $after AND cp.amendStatus = $amendCompleted AND coalesce(cp.mode, ?) <> $previewMode AND coalesce(cp.isDeleted, false) = false AND coalesce(cp.autoQueryEvalClaimUntil, ?) < $now AND coalesce(cp.autoQu…
MATCH (cp:CarePlan) WHERE cp.tildaid > $after AND cp.amendStatus = $amendCompleted AND coalesce(cp.mode, ?) <> $previewMode AND coalesce(cp.isDeleted, false) = false AND coalesce(cp.autoQueryEvalClaimUntil, ?) < $now AND coalesce(cp.autoQueryEvalFailedAt, ?) < $failedBefore MATCH (cp)-[:EXECUTE_SOA]->(:ScheduleOfActivities) -[:SOA_TO_PROTOCOL_VERSION]->(pv:ProtocolVersionV2) WITH cp, collect(DISTINCT pv.tildaid) AS pvIds WHERE size(pvIds) = ? AND coalesce(cp.autoQueryEvalVersion, ?) <> pvIds[?] RETURN cp.tildaid AS id ORDER BY id LIMIT $limit
execsvc
10
2.09 s
25.00 s
20.66 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
MATCH (o:Organization {tildaid: $org_id})-[:STUDY_TO_ORG]-(study:Study {tildaid: $study_id}) -[:PLAN_DEFINITION_TO_STUDY]-(pd:DslPlanDefinition) -[:SOA_TO_PLAN_DEFINITION]-(:ScheduleOfActivities) -[:EXECUTE_SOA]-(cp:CarePlan {tildaid: $careplan_id}) WHERE coalesce(pd.deltimestamp, ?) = ? AND coalesce(cp.isDeleted, false) = false WITH DISTINCT cp, pd, study CALL (cp) { MATCH (cp)-[:CAREPLAN_TO_ALL_PARTICIPANTVISITS]-(:ParticipantVisit) -[:PARTICIPANT_ACTIVITY]-(pa:ParticipantActivity) RETURN pa UNION MATCH (cp)-[:PARTICIPANT_ACTIVITY]-(pa:ParticipantActivity) RETURN pa } WITH cp, pa WHERE pa.carePlanId = cp.tildaid AND ($activity_ids IS NULL OR pa.tildaid IN $activity_ids) MATCH (pa)-[:PARTICIPANT_QUESTIONNAIRE]-(pqnr:ParticipantQuestionnaire) CALL (pqnr) { MATCH (pqnr)-[:PARTICIPANT_QUESTION]-(pqn:ParticipantQuestion) RETURN pqn, pqnr.questionnaireId AS graph_id, NULL AS pt_id UNION MATCH (pqnr)-[:PARTICIPANT_TABLE]-(pt:ParticipantTable) -[:PARTICIPANT_QUESTION]-(pqn:ParticipantQuestion) RETURN pqn, pt.tableId AS graph_id, pt.tildaid AS pt_id } WITH cp, pa, pqnr.tildaid AS pqnr_id, pt_id, pqn, graph_id WHERE pqn.carePlanId = pa.carePlanId MATCH (pqn)-[:BELONGS_TO_QUESTION]-(qn:QuestionV2) OPTIONAL MATCH (qn)-[:GRAPH_NODE_REF_TO_GRAPH_NODE|GRAPH_NODE_REF_TO_QUESTION {protocolid: pa.protocolId}]-(gnode:GraphNode) <-[gnrel:GRAPH_NEXT {graphid: graph_id}]-() WITH pa, pqnr_id, pt_id, pqn, qn, reduce(f = ?, x IN collect(coalesce(gnrel.flags, ?)) | apoc.bitwise.op(f, ?, x)) AS qn_flags OPTIONAL MATCH (pqn)-[:ALL_CHANGELOG]-(sdvcl:ChangeLog {type: ?, newValue: ?}) WITH pa, pqnr_id, pt_id, pqn, qn, qn_flags, max(sdvcl.createdat) AS sdv_verified_at OPTIONAL MATCH (pqn)-[:ALL_CHANGELOG]-(datacl:ChangeLog {type: ?}) WITH pa, pqnr_id, pt_id, pqn, qn, qn_flags, sdv_verified_at, max(datacl.createdat) AS last_data_change RETURN DISTINCT pqn.tildaid AS pq_id, pa.tildaid AS pa_id, pqnr_id, pt_id, qn.tildaid AS question_id, coalesce(qn.title, ?) AS title, qn.variablename AS variable, coalesce(pqn.value, ?) AS value, coalesce(pqn.status, ?) AS status, coalesce(pqn.sdvVerified, false) AS sdv_verified, sdv_verified_at, last_data_change, coalesce(pqn.changeLogCount, ?) AS change_count, pqn.hdmClassId AS hdm_class_id, pqn.hdmObjId AS hdm_obj_id, apoc.bitwise.op(qn_flags, ?, ?) <> ? AS critical ORDER BY pa_id, pq_id
data_monitor
6
10.13 s
19.25 s
11.38 s
flat
// Same AIRun.status seeding and collect/UNWIND barrier as // count_in_progress_and_aborted_ai_runs; see the note there. MATCH (ai:AIRun) WHERE ai.status IN [?, ?] AND ( (ai.status = ? AND ($cutoff_ms <= ? OR COALESCE(ai.updatedat, ai.crea…
// Same AIRun.status seeding and collect/UNWIND barrier as // count_in_progress_and_aborted_ai_runs; see the note there. MATCH (ai:AIRun) WHERE ai.status IN [?, ?] AND ( (ai.status = ? AND ($cutoff_ms <= ? OR COALESCE(ai.updatedat, ai.createdat) < $cutoff_ms)) OR (ai.status = ? AND ($aborted_cutoff_ms <= ? OR COALESCE(ai.updatedat, ai.createdat) < $aborted_cutoff_ms)) ) WITH collect(ai) AS adoptable_runs UNWIND adoptable_runs AS ai MATCH (ai)-[:AI_RUN_TO_DOCUMENT_LATEST]->(d:Document) WHERE d.aiEnabled = true MATCH (d)-[:DOC_TO_ORG]->(o:Organization) OPTIONAL MATCH (d)-[:UPLOADED_BY]->(uploader:User) WITH ai, d, o, head(collect(uploader.email)) AS uploaded_by RETURN d.tildaid AS document_id, d.primaryVersionId AS version_id, ai.tildaid AS ai_run_id, d.studyId AS study_id, ai.run_type AS run_type, o.tildaid AS org_id, o.alias AS org_alias, COALESCE(ai.updatedat, ai.createdat) AS last_touched_ms, ai.status AS ai_run_status, COALESCE(ai.auto_retry_count, ?) AS current_retry_count, // carries the trace + identity of whoever caused this run; see origin_context() ai.request_info AS request_info, // who the document belongs to, for when request_info carries no identity uploaded_by ORDER BY COALESCE(ai.updatedat, ai.createdat) ASC LIMIT $limit
docproc
2
8.61 s
19.00 s
17.21 s
flat
MATCH (act:FormV2) WHERE act.type = ? AND (act.scopeid = ? OR act.scopeid IS NULL) AND (act.supportsglobalactivitybottomup IS NULL OR act.supportsglobalactivitybottomup = false) RETURN act.tildaid ORDER BY act.tildaid LIMIT ?
MATCH (act:FormV2) WHERE act.type = ? AND (act.scopeid = ? OR act.scopeid IS NULL) AND (act.supportsglobalactivitybottomup IS NULL OR act.supportsglobalactivitybottomup = false) RETURN act.tildaid ORDER BY act.tildaid LIMIT ?
studiosvc
2
13.40 s
19.00 s
17.76 s
flat
// Seeded from AIRun.status, not from a Document label scan: as a single MATCH the // planner drove this from (d:Document), scanning ?,? nodes every sweep to reach // ~? linked runs (?,? db hits measured). The status list is hoisted out of…
// Seeded from AIRun.status, not from a Document label scan: as a single MATCH the // planner drove this from (d:Document), scanning ?,? nodes every sweep to reach // ~? linked runs (?,? db hits measured). The status list is hoisted out of the // OR to make it seekable, and the collect/UNWIND is a planner barrier — without it // the Document scan was still preferred even with AIRun_status present. Degrades to // an AIRun label scan if that index is missing, so it is safe ahead of the migration. MATCH (ai:AIRun) WHERE ai.status IN [?, ?] AND ( (ai.status = ? AND ($cutoff_ms <= ? OR COALESCE(ai.updatedat, ai.createdat) < $cutoff_ms)) OR (ai.status = ? AND ($aborted_cutoff_ms <= ? OR COALESCE(ai.updatedat, ai.createdat) < $aborted_cutoff_ms)) ) WITH collect(ai) AS adoptable_runs UNWIND adoptable_runs AS ai MATCH (ai)-[:AI_RUN_TO_DOCUMENT_LATEST]->(d:Document) WHERE d.aiEnabled = true RETURN count(ai) AS total
docproc
3
6.22 s
18.50 s
18.64 s
flat
// Seeded from AIRun.status, not from a Document label scan: as a single MATCH the // planner drove this from (d:Document), scanning ?,? nodes every sweep to reach // ~? linked runs (?,? db hits measured). The status list is hoisted out of…
// Seeded from AIRun.status, not from a Document label scan: as a single MATCH the // planner drove this from (d:Document), scanning ?,? nodes every sweep to reach // ~? linked runs (?,? db hits measured). The status list is hoisted out of the // OR to make it seekable, and the collect/UNWIND is a planner barrier — without it // the Document scan was still preferred even with AIRun_status present. Degrades to // an AIRun label scan if that index is missing, so it is safe ahead of the migration. MATCH (ai:AIRun) WHERE ai.status IN [?, ?] AND ( (ai.status = ? AND ($cutoff_ms <= ? OR COALESCE(ai.updatedat, ai.createdat) < $cutoff_ms)) OR (ai.status = ? AND ($aborted_cutoff_ms <= ? OR COALESCE(ai.updatedat, ai.createdat) < $aborted_cutoff_ms)) ) WITH collect(ai) AS adoptable_runs UNWIND adoptable_runs AS ai MATCH (ai)-[:AI_RUN_TO_DOCUMENT_LATEST]->(d:Document) WHERE d.aiEnabled = true RETURN count(ai) AS total
MATCH (wp:WorkPlanInstance) WHERE wp.instanceReadyDeterminationState IN [?, ?] AND wp.state <> ? OPTIONAL MATCH (wp)<-[:WORKPLAN_JOB_TO_OBJ]-(job:WorkplanJob) WITH wp, count(job) AS jobN WHERE jobN = ? RETURN wp.tildaid AS id LIMIT $limit
MATCH (wp:WorkPlanInstance) WHERE wp.instanceReadyDeterminationState IN [?, ?] AND wp.state <> ? OPTIONAL MATCH (wp)<-[:WORKPLAN_JOB_TO_OBJ]-(job:WorkplanJob) WITH wp, count(job) AS jobN WHERE jobN = ? RETURN wp.tildaid AS id LIMIT $limit
MATCH (o:Organization {tildaid: $org_id})-[:STUDY_TO_ORG]-(study:Study {tildaid: $study_id}) -[:PLAN_DEFINITION_TO_STUDY]-(pd:DslPlanDefinition) -[:SOA_TO_PLAN_DEFINITION]-(:ScheduleOfActivities) -[:EXECUTE_SOA]-(cp:CarePlan {tildaid: $careplan_id}) WHERE coalesce(pd.deltimestamp, ?) = ? AND coalesce(cp.isDeleted, false) = false WITH DISTINCT cp, pd, study MATCH (cp)-[:CAREPLAN_TO_ALL_PARTICIPANTVISITS]-(:ParticipantVisit) -[:PARTICIPANT_ACTIVITY]-(pa:ParticipantActivity) WHERE pa.carePlanId = cp.tildaid MATCH (pa)-[:PARTICIPANT_QUESTIONNAIRE]-(pqnr:ParticipantQuestionnaire) CALL (pqnr) { MATCH (pqnr)-[:PARTICIPANT_QUESTION]-(pqn:ParticipantQuestion) RETURN pqn, pqnr.questionnaireId AS graph_id, NULL AS pt_id UNION MATCH (pqnr)-[:PARTICIPANT_TABLE]-(pt:ParticipantTable) -[:PARTICIPANT_QUESTION]-(pqn:ParticipantQuestion) RETURN pqn, pt.tableId AS graph_id, pt.tildaid AS pt_id } WITH cp, pa, pqnr.tildaid AS pqnr_id, pt_id, pqn, graph_id WHERE pqn.carePlanId = pa.carePlanId MATCH (pqn)-[:BELONGS_TO_QUESTION]-(qn:QuestionV2) OPTIONAL MATCH (qn)-[:GRAPH_NODE_REF_TO_GRAPH_NODE|GRAPH_NODE_REF_TO_QUESTION {protocolid: pa.protocolId}]-(gnode:GraphNode) <-[gnrel:GRAPH_NEXT {graphid: graph_id}]-() WITH pa, pqnr_id, pt_id, pqn, qn, reduce(f = ?, x IN collect(coalesce(gnrel.flags, ?)) | apoc.bitwise.op(f, ?, x)) AS qn_flags OPTIONAL MATCH (pqn)-[:ALL_CHANGELOG]-(sdvcl:ChangeLog {type: ?, newValue: ?}) WITH pa, pqnr_id, pt_id, pqn, qn, qn_flags, max(sdvcl.createdat) AS sdv_verified_at OPTIONAL MATCH (pqn)-[:ALL_CHANGELOG]-(datacl:ChangeLog {type: ?}) WITH pa, pqnr_id, pt_id, pqn, qn, qn_flags, sdv_verified_at, max(datacl.createdat) AS last_data_change WHERE qn.title =~ ? RETURN DISTINCT pqn.tildaid AS pq_id, pa.tildaid AS pa_id, pqnr_id, pt_id, qn.tildaid AS question_id, coalesce(qn.title, ?) AS title, qn.variablename AS variable, coalesce(pqn.value, ?) AS value, coalesce(pqn.status, ?) AS status, coalesce(pqn.sdvVerified, false) AS sdv_verified, sdv_verified_at, last_data_change, coalesce(pqn.changeLogCount, ?) AS change_count, pqn.hdmClassId AS hdm_class_id, pqn.hdmObjId AS hdm_obj_id, apoc.bitwise.op(qn_flags, ?, ?) <> ? AS critical , qn.title =~ ? AS is_consent ORDER BY is_consent, title, pq_id
data_monitor
6
8.33 s
9.75 s
9.77 s
flat
call db.clearQueryCaches()
call db.clearQueryCaches()
(internal)
7
3.44 s
9.56 s
6.55 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
2
2.93 s
9.50 s
5.85 s
flat
MATCH (b:Budget) WHERE b.status = ? AND date(b.effectiveDate) <= date() RETURN b.tildaid
MATCH (b:Budget) WHERE b.status = ? AND date(b.effectiveDate) <= date() RETURN b.tildaid
finsvc
3
2.89 s
9.25 s
8.65 s
flat
MATCH (task:Task) WHERE task.task_number = ? AND EXISTS { (task)-[:BELONGS_TO]->(:Inbox{type:?})-[:MANAGED_BY]->(:Organization) } RETURN task.tildaid LIMIT ?
MATCH (task:Task) WHERE task.task_number = ? AND EXISTS { (task)-[:BELONGS_TO]->(:Inbox{type:?})-[:MANAGED_BY]->(:Organization) } RETURN task.tildaid LIMIT ?
tusker
3
1.96 s
9.25 s
5.88 s
flat
call { match (task:Task{assignment:?}) where (task.state = ? or task.state = ?) and not exists ((task)-[:BELONGS_TO]-(:Inbox{type:?})) and coalesce(task.dist_next_retry_at <= datetime(), coalesce(task.dist_deferred, false) = false) return …
call { match (task:Task{assignment:?}) where (task.state = ? or task.state = ?) and not exists ((task)-[:BELONGS_TO]-(:Inbox{type:?})) and coalesce(task.dist_next_retry_at <= datetime(), coalesce(task.dist_deferred, false) = false) return task } with task where not exists ( (task)-[:CREATED_FROM_SPEC]-(:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantControl) ) and not exists ( (task)<-[:CREATED_FROM_SPEC]-(:ParticipantDslSpecNode)<-[:PARTICIPANT_DSLTASK_TO_ALL_PARTICIPANT_DSLSPECNODE]-(:ParticipantDslTask)<-[:PARTICIPANT_DSLTASK]-(:ParticipantControl) ) match (task)-[:WITH_CONTEXT]->() optional match (task)-[:BELONGS_TO]->(userinbox:Inbox{type:?})-[:OWNED_BY]->(user:User) optional match (user)-[:USER_TO_PATIENT]-(patient:Patient) optional match (task)-[:BELONGS_TO]->(:Inbox{type:?})-[:MANAGED_BY]->(org:Organization) optional match (task)-[:BELONGS_TO]->(:Inbox{type:?})-[:MANAGED_BY]->(study:Study) optional match (task)-[:BELONGS_TO]->(:Inbox{type:?})-[:MANAGED_BY]->(site:Site) return distinct task, userinbox, org, study.name, site.name, patient.tildaid skip $skip limit $limit
tusker
3
2.94 s
9.25 s
8.56 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-config-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-config-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-config-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 UNION // scope=Organization policies=org-study-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_2 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-study-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_3 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
tmfsync
3
1.71 s
9.25 s
5.11 s
flat
MATCH (ctx:Study)<-[:PLAN_CONTEXT]-(ep:EventPlan {orgId: $orgId})-[:EVENTS]->(e:Event) WHERE ctx.tildaid IN $contextIds WITH DISTINCT e OPTIONAL MATCH (e)<-[:PART_OF_EVENT]-(statusScope:EventScope) WITH e, statusScope WHERE (statusScope IS…
MATCH (ctx:Study)<-[:PLAN_CONTEXT]-(ep:EventPlan {orgId: $orgId})-[:EVENTS]->(e:Event) WHERE ctx.tildaid IN $contextIds WITH DISTINCT e OPTIONAL MATCH (e)<-[:PART_OF_EVENT]-(statusScope:EventScope) WITH e, statusScope WHERE (statusScope IS NULL AND e.status = $status) OR statusScope.status in $scopeStatuses WITH DISTINCT e WHERE e.isTemplate = $isTemplate WITH DISTINCT e ORDER BY e.createdat DESC SKIP $skip LIMIT $limit OPTIONAL MATCH (e)<-[:EVENTS]-(ep:EventPlan)-[:PLAN_CONTEXT]->(study) WITH e, study CALL { WITH e, study // Get details for each scope in the event OPTIONAL MATCH (e)<-[:PART_OF_EVENT]-(scope:EventScope) WHERE (scope IS NULL AND e.status = $status) OR scope.status in $scopeStatuses OPTIONAL MATCH (site:Site {tildaid: scope.scopeId}) OPTIONAL MATCH (site)-[:PLAN_DEFINITION_TO_SITE]-(pd:DslPlanDefinition{type:?})-[:PLAN_DEFINITION_TO_STUDY]->(study) WITH scope, CASE WHEN scope.scopeType = ? THEN site.name ELSE ? END as siteName, CASE WHEN scope.scopeType = ? THEN COALESCE(pd.siteNumber, ?) ELSE ? END as siteNumber OPTIONAL MATCH (scope)-[:APPLICABLE_TO]->(scopeDeliverable:Deliverable) CALL { // Get details of each deliverable applicable to the scope WITH scope, scopeDeliverable OPTIONAL MATCH (scopeDeliverable)-[tracksRel:TRACKS_PLACEHOLDER]->(ph:Document)-[:SCOPED_TO]->(scope) CALL { // Get match status for each placeholder WITH ph, tracksRel, scope OPTIONAL MATCH (ph)-[acceptedRel:ACCEPTED_DOCUMENT]->(acceptedDoc:Document) OPTIONAL MATCH (ph)-[matchRel:MATCHING_DOCUMENT]->(matchDoc:Document) WHERE acceptedDoc IS NULL OR matchDoc.tildaid <> acceptedDoc.tildaid WITH ph, tracksRel, scope, acceptedDoc, [m IN collect(matchDoc) WHERE m IS NOT NULL] as matchDocs WITH ph, tracksRel, scope, acceptedDoc, CASE WHEN ph.status <> ? THEN ? WHEN acceptedDoc IS NOT NULL THEN ? WHEN SIZE(matchDocs) > ? AND all(m IN matchDocs WHERE m.collection = ?) THEN ? WHEN SIZE(matchDocs) > ? THEN ? ELSE ? END as matchStatus RETURN CASE WHEN ph IS NULL THEN null ELSE {tildaid: ph.tildaid, fileName: ph.fileName, status: matchStatus, placeholderState: COALESCE(tracksRel.state, ?), archived: coalesce(ph.archived, false) OR scope.status = ?} END as deliverablePlaceholder } WITH collect(DISTINCT deliverablePlaceholder) as deliverablePlaceholders WITH [d IN deliverablePlaceholders WHERE d IS NOT NULL] as allPlaceholders RETURN allPlaceholders as deliverablePlaceholders, { total: size(allPlaceholders), pending: size([pp IN allPlaceholders WHERE pp.placeholderState IN [?, ?]]), pendingForDelete: size([pp IN allPlaceholders WHERE pp.placeholderState = ?]), accepted: size([pp IN allPlaceholders WHERE pp.placeholderState = ?]), rejected: size([pp IN allPlaceholders WHERE pp.placeholderState = ?]), incomplete: size([pp IN allPlaceholders WHERE pp.status = ?]), potentialMatchFound: size([pp IN allPlaceholders WHERE pp.status = ?]), matchExpected: size([pp IN allPlaceholders WHERE pp.status = ?]), matched: size([pp IN allPlaceholders WHERE pp.status = ?]), finalized: size([pp IN allPlaceholders WHERE pp.status = ?]), completion: {required: size([pp IN allPlaceholders WHERE NOT (pp.placeholderState = ? OR coalesce(pp.archived, false)) AND (pp.placeholderState IN [?, ?] OR pp.status = ?)]), completed: size([pp IN allPlaceholders WHERE NOT (pp.placeholderState = ? OR coalesce(pp.archived, false)) AND (pp.placeholderState IN [?, ?] OR pp.status = ?) AND pp.status IN [?, ?]]), aiSuggested: size([pp IN allPlaceholders WHERE NOT (pp.placeholderState = ? OR coalesce(pp.archived, false)) AND (pp.placeholderState IN [?, ?] OR pp.status = ?) AND pp.status = ?]), inStaging: size([pp IN allPlaceholders WHERE NOT (pp.placeholderState = ? OR coalesce(pp.archived, false)) AND (pp.placeholderState IN [?, ?] OR pp.status = ?) AND pp.status = ?]), noMatchFound: size([pp IN allPlaceholders WHERE NOT (pp.placeholderState = ? OR coalesce(pp.archived, false)) AND (pp.placeholderState IN [?, ?] OR pp.status = ?) AND pp.status = ?]), notConfirmed: size([pp IN allPlaceholders WHERE NOT (pp.placeholderState = ? OR coalesce(pp.archived, false)) AND pp.placeholderState = ? AND NOT pp.status = ?]), removed: size([pp IN allPlaceholders WHERE (pp.placeholderState = ? OR coalesce(pp.archived, false))]), percentComplete: CASE WHEN size([pp IN allPlaceholders WHERE NOT (pp.placeholderState = ? OR coalesce(pp.archived, false)) AND (pp.placeholderState IN [?, ?] OR pp.status = ?)]) = ? THEN null ELSE toInteger(floor(?.? * size([pp IN allPlaceholders WHERE NOT (pp.placeholderState = ? OR coalesce(pp.archived, false)) AND (pp.placeholderState IN [?, ?] OR pp.status = ?) AND pp.status IN [?, ?]]) / size([pp IN allPlaceholders WHERE NOT (pp.placeholderState = ? OR coalesce(pp.archived, false)) AND (pp.placeholderState IN [?, ?] OR pp.status = ?)]))) END, isComplete: size([pp IN allPlaceholders WHERE NOT (pp.placeholderState = ? OR coalesce(pp.archived, false)) AND (pp.placeholderState IN [?, ?] OR pp.status = ?)]) > ? AND size([pp IN allPlaceholders WHERE NOT (pp.placeholderState = ? OR coalesce(pp.archived, false)) AND (pp.placeholderState IN [?, ?] OR pp.status = ?) AND pp.status IN [?, ?]]) = size([pp IN allPlaceholders WHERE NOT (pp.placeholderState = ? OR coalesce(pp.archived, false)) AND (pp.placeholderState IN [?, ?] OR pp.status = ?)])} } as deliverableStats } // Aggregate all deliverables in the scope WITH scope, siteName, siteNumber, deliverableStats WITH distinct scope, siteName, siteNumber, { total: sum(deliverableStats.total), pending: sum(deliverableStats.pending), pendingForDelete: sum(deliverableStats.pendingForDelete), accepted: sum(deliverableStats.accepted), rejected: sum(deliverableStats.rejected), incomplete: sum(deliverableStats.incomplete), potentialMatchFound: sum(deliverableStats.potentialMatchFound), matchExpected: sum(deliverableStats.matchExpected), matched: sum(deliverableStats.matched), finalized: sum(deliverableStats.finalized), completion: {required: sum(deliverableStats.completion.required), completed: sum(deliverableStats.completion.completed), aiSuggested: sum(deliverableStats.completion.aiSuggested), inStaging: sum(deliverableStats.completion.inStaging), noMatchFound: sum(deliverableStats.completion.noMatchFound), notConfirmed: sum(deliverableStats.completion.notConfirmed), removed: sum(deliverableStats.completion.removed), percentComplete: CASE WHEN sum(deliverableStats.completion.required) = ? THEN null ELSE toInteger(floor(?.? * sum(deliverableStats.completion.completed) / sum(deliverableStats.completion.required))) END, isComplete: sum(deliverableStats.completion.required) > ? AND sum(deliverableStats.completion.completed) = sum(deliverableStats.completion.required)} } as scopeStats RETURN distinct scope{.*, siteName: siteName, siteNumber: siteNumber} as scope, scopeStats } CALL { // Collect summary for all deliverable in the event WITH e OPTIONAL MATCH (e)-[:REQUIRES_RESOLUTION_OF]->(eventDel:Deliverable) WITH collect(eventDel) as deliverables, [d IN collect(distinct eventDel) WHERE d.warning IS NOT NULL AND d.warning <> ? | ??\? + d.warning] as deliverableWarnings RETURN { trialDeliverables: SIZE([d in deliverables WHERE d.applyToTrial = true]), countryDeliverables: SIZE([d in deliverables WHERE d.applyToCountries = true]), siteDeliverables: SIZE([d in deliverables WHERE d.applyToSites = true]) } as deliverableCounts, deliverableWarnings } CALL { // Fetch createdBy WITH e OPTIONAL MATCH (e)-[:ALL_CHANGELOG]->(cl:ChangeLog{operation:?}) WITH cl ORDER BY cl.createdat ASC limit ? OPTIONAL MATCH (u:User{tildaid:cl.changedBy}) return {id: u.tildaid, name: u.name, profilePicURL: u.profilePicURL} as createdBy } // Aggregate all scopes and all deliverables in the event WITH e, study, createdBy, deliverableCounts, deliverableWarnings, collect(scope) as eventScopes, { total: sum(scopeStats.total), pending: sum(scopeStats.pending), pendingForDelete: sum(scopeStats.pendingForDelete), accepted: sum(scopeStats.accepted), rejected: sum(scopeStats.rejected), incomplete: sum(scopeStats.incomplete), potentialMatchFound: sum(scopeStats.potentialMatchFound), matchExpected: sum(scopeStats.matchExpected), matched: sum(scopeStats.matched), finalized: sum(scopeStats.finalized), completion: {required: sum(scopeStats.completion.required), completed: sum(scopeStats.completion.completed), aiSuggested: sum(scopeStats.completion.aiSuggested), inStaging: sum(scopeStats.completion.inStaging), noMatchFound: sum(scopeStats.completion.noMatchFound), notConfirmed: sum(scopeStats.completion.notConfirmed), removed: sum(scopeStats.completion.removed), percentComplete: CASE WHEN sum(scopeStats.completion.required) = ? THEN null ELSE toInteger(floor(?.? * sum(scopeStats.completion.completed) / sum(scopeStats.completion.required))) END, isComplete: sum(scopeStats.completion.required) > ? AND sum(scopeStats.completion.completed) = sum(scopeStats.completion.required)} } as eventProgress WITH e, study, createdBy, deliverableCounts, deliverableWarnings, eventProgress, eventScopes, { totalCountries: SIZE([s IN eventScopes WHERE s.scopeType = ?]), totalSites: SIZE([s IN eventScopes WHERE s.scopeType = ?]), countries: [s IN eventScopes WHERE s.scopeType = ? | {name: s.scopeId, id: s.scopeId}], sites: [s IN eventScopes WHERE s.scopeType = ? | {name: s.siteName, id: s.scopeId, siteNumber: s.siteNumber}] } as scopeSummary CALL { WITH e OPTIONAL MATCH (woc:WorkOrderConfig)-[:WORK_ORDER_CONFIG_TO_EVENT]->(e) RETURN woc.tildaid as workOrderConfigId LIMIT ? } RETURN e{.*, createdBy: createdBy, warnings: deliverableWarnings, scopeSummary: scopeSummary, progress: eventProgress, workOrderConfigId: workOrderConfigId, contextId: COALESCE(study.tildaid, ?), contextType: CASE WHEN study IS NULL THEN ? ELSE head(labels(study)) END, contextName: COALESCE(study.name, ?), aiState: CASE WHEN SIZE(eventScopes) = ? THEN ? WHEN SIZE([s IN eventScopes WHERE s.aiState <> ? AND s.aiState IS NOT NULL]) = ? THEN ? ELSE ? END, trialDeliverables: deliverableCounts.trialDeliverables, countryDeliverables: deliverableCounts.countryDeliverables, siteDeliverables: deliverableCounts.siteDeliverables} as result
writedocsvc
9
626 ms
7.75 s
5.61 s
flat
MATCH (j:ZipExtractionJob {status: $status}) WHERE coalesce(j.attempts, ?) < $max_attempts AND j.lastAttemptAt < timestamp() - $stale_ms MATCH (d:Document {tildaid: j.zipDocId}) WHERE coalesce(d.archived, false) = false CALL (j) { MATCH (m…
MATCH (j:ZipExtractionJob {status: $status}) WHERE coalesce(j.attempts, ?) < $max_attempts AND j.lastAttemptAt < timestamp() - $stale_ms MATCH (d:Document {tildaid: j.zipDocId}) WHERE coalesce(d.archived, false) = false CALL (j) { MATCH (m:ZipExtractionMember {zipDocId: j.zipDocId}) RETURN count(m) AS ledger_rows, max(m.updatedAt) AS last_member_at } WITH j, d, ledger_rows, last_member_at // A crash between recording the job and the first ledger write leaves no // members at all; fall back to the job's own timestamp so those are still // found rather than sitting unnoticed forever. WHERE CASE WHEN ledger_rows = ? THEN true ELSE last_member_at < timestamp() - $stale_ms END // Who uploaded the archive: the resume acts as them, so the member documents it // creates through docsvc (and the processing they trigger) are attributed to them. OPTIONAL MATCH (d)-[:UPLOADED_BY]->(uploader:User) WITH j, ledger_rows, head(collect(uploader.email)) AS uploader_email RETURN j.zipDocId AS zip_doc_id, j.orgAlias AS org_alias, coalesce(j.attempts, ?) AS attempts, ledger_rows AS ledger_rows, uploader_email ORDER BY j.lastAttemptAt ASC LIMIT $limit
docproc
10
732 ms
7.50 s
7.27 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
10
1.08 s
7.50 s
8.50 s
flat
MATCH (t:Task)-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(ptl:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(pa:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]->(pw:ParticipantWorkflow) WHERE t.state IN [?, ?] …
MATCH (t:Task)-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(ptl:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(pa:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]->(pw:ParticipantWorkflow) WHERE t.state IN [?, ?] AND ptc.status <> ? RETURN DISTINCT t.tildaid UNION MATCH (t:Task)-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(ptl:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(pc:ParticipantControl)-[:PARTICIPANT_CONTROL]-(pa:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]->(pw:ParticipantWorkflow) WHERE t.state IN [?, ?] AND ptc.status <> ? RETURN DISTINCT t.tildaid UNION match (t:Task)-[:CREATED_FROM_SPEC]-(ptd:ParticipantTodo)-[:PARTICIPANT_TODO]-(pc:ParticipantControl)-[:PARTICIPANT_CONTROL]-(pa:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) where t.state in [?, ?] and ptd.status <> ? return distinct t.tildaid
regsvc
10
862 ms
7.50 s
8.51 s
flat
MATCH (a:Study{tildaid:$a_tildaid}),(b:FolderManager{tildaid:$b_tildaid}) MERGE (a)-[r:USES]->(b) ON CREATE SET r.tildaid = randomUUID(), r.createdat = timestamp() ON MATCH SET r.updatedat = timestamp() RETURN count(r)
MATCH (a:Study{tildaid:$a_tildaid}),(b:FolderManager{tildaid:$b_tildaid}) MERGE (a)-[r:USES]->(b) ON CREATE SET r.tildaid = randomUUID(), r.createdat = timestamp() ON MATCH SET r.updatedat = timestamp() RETURN count(r)
MATCH (b:Study{tildaid: $studyId}) CREATE (a:DslPlanDefinition{deltimestamp: ?, studyId: $studyId, scopeId: $scopeId}) SET a.createdat = timestamp(), a.updatedat = timestamp(), a.tildaid = randomUUID(), a.holdbitmap = $svcBitId, a.delpending = false, a.siteNumber = $siteNumber, a.scopeName = $scopeName, a.type = $type, a.status = $status, a.edcDataCapture = $edcDataCapture, a.sourceDataCapture = $sourceDataCapture MERGE (a)-[r:PLAN_DEFINITION_TO_STUDY]->(b) ON CREATE SET r.tildaid = randomUUID(), r.createdat = timestamp() ON MATCH SET r.updatedat = timestamp() RETURN a.tildaid, a.createdat
writeexecsvc
1
2.71 s
4.85 s
2.71 s
flat
UNWIND $rows AS row MATCH (a:Inbox{tildaid:row.fromId}) MATCH (b:Study{tildaid:row.toId}) MERGE (a)-[r:MANAGED_BY]->(b) ON CREATE SET r += row.props, r.tildaid = randomUUID(), r.createdat = timestamp() ON MATCH SET r.updatedat = timestamp(…
UNWIND $rows AS row MATCH (a:Inbox{tildaid:row.fromId}) MATCH (b:Study{tildaid:row.toId}) MERGE (a)-[r:MANAGED_BY]->(b) ON CREATE SET r += row.props, r.tildaid = randomUUID(), r.createdat = timestamp() ON MATCH SET r.updatedat = timestamp() RETURN count(r)
writetusker
1
3.11 s
4.85 s
3.11 s
flat
match (org:Organization{tildaid:$pdOrgId})-[:STUDY_TO_ORG]- (st:Study{tildaid:$pdStudyId}) call { with org,st with org,st match (org)-[:STUDY_TO_ORG]-(st)-[:PLAN_DEFINITION_TO_STUDY]- (pd:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(site…
match (org:Organization{tildaid:$pdOrgId})-[:STUDY_TO_ORG]- (st:Study{tildaid:$pdStudyId}) call { with org,st with org,st match (org)-[:STUDY_TO_ORG]-(st)-[:PLAN_DEFINITION_TO_STUDY]- (pd:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(site:Site) where (org.orgType=? or org.orgType=?) return site, pd union with org,st with org,st match (org)-[:IS_AN_ORG]-(:Smo)-[:SITE_TO_SMO]-(site:Site)-[:PLAN_DEFINITION_TO_SITE]- (pd:DslPlanDefinition)-[:PLAN_DEFINITION_TO_STUDY]-(st) return site, pd } match (pd)-[:SOA_TO_PLAN_DEFINITION]-(soa:ScheduleOfActivities)-[:EXECUTE_SOA]-(cp:CarePlan) match (cp)-[:CAREPLAN_TO_ALL_PARTICIPANTVISITS]-(pv:ParticipantVisit) where pv.status in $completedVisitStatuses optional match (pv)-[:BELONGS_TO_VISIT]-(v:VisitV2)-[:GRAPH_NODE_REF_TO_GRAPH_NODE{protocolid:pv.protocolId}]-(vref:GraphNodeRef) match (pv)-[:PARTICIPANT_ACTIVITY]-(pa:ParticipantActivity) where apoc.bitwise.op(coalesce(pa.edcBitMap,?),?, ?)=? optional match (pa)-[:BELONGS_TO_ACTIVITY]-(a:ActivityV2)<-[:GRAPH_NODE_REF_TO_GRAPH_NODE{protocolid:pa.protocolId}]-(aref:GraphNodeRef)<-[r2:GRAPH_NEXT]-(:GraphNode) where r2.path[?]=pv.visitId with site, pd, cp, pv, v, vref, collect({id: aref.tildaid, title: a.title}) as acts with site, pd, cp, collect({id: vref.tildaid, title: v.title, pvId: pv.tildaid, signedOffByTeam: pv.signedOffByTeam, edcSignedOffByTeam: pv.edcSignedOffByTeam, status: pv.status, appointmentDate: pv.appointmentDate , hasUnfreezeRequest: exists((pv)-[:WITH_CONTEXT]-(:Task{category:?, state:?})) , activities: acts}) as pvs with site, pd, collect({id: cp.tildaid, subjectId: cp.subjectid, visits: pvs}) as cps return collect({id: site.tildaid, siteNumber: pd.siteNumber, subjects: cps}) as sites
execsvc
1
3.32 s
4.85 s
3.32 s
flat
MATCH (s:Study)-[r:STUDY_TO_ACTOR]->(a:Actor) WHERE r.applyToStudyRoleFlag = false MATCH (s)-[r2:STUDY_TO_ACTOR]->(a) WHERE id(r2) <> id(r) DELETE r
MATCH (s:Study)-[r:STUDY_TO_ACTOR]->(a:Actor) WHERE r.applyToStudyRoleFlag = false MATCH (s)-[r2:STUDY_TO_ACTOR]->(a) WHERE id(r2) <> id(r) DELETE r
writeexecsvc
1
3.52 s
4.85 s
3.52 s
flat
MATCH (ssa:StudySiteActor {delpending:false}) WHERE ssa.location IS NULL OR ssa.location = ? SET ssa.location = ?
MATCH (ssa:StudySiteActor {delpending:false}) WHERE ssa.location IS NULL OR ssa.location = ? SET ssa.location = ?
writeexecsvc
1
2.23 s
4.85 s
2.23 s
flat
MATCH (cfg:WorkplanCfg) WHERE cfg.progressPending = true AND coalesce(cfg.lastViewedAtMs, ?) > (timestamp() - ?) AND (timestamp() - coalesce(cfg.lastProgressComputedAtMs, ?)) > coalesce(cfg.progressComputeIntervalMs, ?) RETURN cfg.tildaid …
MATCH (cfg:WorkplanCfg) WHERE cfg.progressPending = true AND coalesce(cfg.lastViewedAtMs, ?) > (timestamp() - ?) AND (timestamp() - coalesce(cfg.lastProgressComputedAtMs, ?)) > coalesce(cfg.progressComputeIntervalMs, ?) RETURN cfg.tildaid AS id, coalesce(cfg.progressDirtyAtMs, ?) AS dirtyAtMs LIMIT $limit
workplansvc
1
3.25 s
4.85 s
3.25 s
flat
DROP DATABASE neo4j IF EXISTS
DROP DATABASE neo4j IF EXISTS
write(internal)
1
2.04 s
4.85 s
2.04 s
flat
MATCH (org:Organization{tildaid:$scopeOrgId0}) CALL { WITH org UNWIND $lists.allowedStudies0 AS studyId OPTIONAL MATCH (study:Study) WHERE study.tildaid = studyId // An inactive actor carries no membership, so it is excluded here rather th…
MATCH (org:Organization{tildaid:$scopeOrgId0}) CALL { WITH org UNWIND $lists.allowedStudies0 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??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?? ?Received?Quality Control?PHI Issues???/???/???/') ELSE ? END as childFolderPath WITH docObj, ct, child, st, head(collect(childFolderPath)) AS childFolderPath WITH child, CASE WHEN ct IS NULL THEN null ELSE { documentId: child.tildaid, studyId: COALESCE(child.studyId, ?), studyName: COALESCE(st.name, ?), folderPath: childFolderPath, kind: ct.kind, stale: ct.sourceVersionId <> docObj.primaryVersionId, version: COALESCE(child.versionName, toString(child.majorVersion)) } END as copiedToEntry RETURN collect(copiedToEntry) as copiedTo, count(DISTINCT child) as copiedToCount } CALL { 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
1
3.39 s
4.85 s
3.39 s
flat
MATCH (cp:CarePlan)-[:EXECUTE_SOA]->(:ScheduleOfActivities)-[:SOA_TO_PROTOCOL_VERSION]->(a:ProtocolVersionV2) WHERE coalesce(cp.mode,?) = ? OR cp.mode <> ? MATCH (st:Study {tildaid: cp.studyId}) WHERE NOT toLower(st.name) =~ ? AND EXISTS {…
MATCH (cp:CarePlan)-[:EXECUTE_SOA]->(:ScheduleOfActivities)-[:SOA_TO_PROTOCOL_VERSION]->(a:ProtocolVersionV2) WHERE coalesce(cp.mode,?) = ? OR cp.mode <> ? MATCH (st:Study {tildaid: cp.studyId}) WHERE NOT toLower(st.name) =~ ? AND EXISTS { (st)-[:STUDY_TO_ORG]->(o:Organization) WHERE NOT toLower(o.name) =~ ? AND NOT o.name =~ ? } CALL (cp) { MATCH (cp)-[:CAREPLAN_TO_ALL_PARTICIPANTVISITS]->(:ParticipantVisit)-[:PARTICIPANT_ACTIVITY]->(pa:ParticipantActivity) RETURN pa UNION MATCH (cp)-[:PARTICIPANT_ACTIVITY]->(pa:ParticipantActivity) RETURN pa } WITH a, pa WHERE pa.protocolId IS NOT NULL AND pa.protocolId <> a.tildaid WITH a, pa.protocolId AS pid, count(DISTINCT pa) AS pas MATCH (p:ProtocolVersionV2 {tildaid: pid}) WITH a,p,pas, COUNT { (p)-[:PROTOCOL_TO_GRAPH_NODE_REF]->(r:GraphNodeRef) WHERE EXISTS {(a)-[:PROTOCOL_TO_GRAPH_NODE_REF]->(r)} } AS shared RETURN shared=? AS noOverlap, count(*) AS pairs, sum(pas) AS pas
(internal)
1
3.48 s
4.85 s
3.48 s
flat
MATCH (cp:CarePlan)-[r1]-(x)-[r2]-(s:Site) WITH type(r1) AS a, labels(x) AS l, type(r2) AS b, count(*) AS n RETURN a,l,b,n ORDER BY n DESC LIMIT ?
MATCH (cp:CarePlan)-[r1]-(x)-[r2]-(s:Site) WITH type(r1) AS a, labels(x) AS l, type(r2) AS b, count(*) AS n RETURN a,l,b,n ORDER BY n DESC LIMIT ?
(internal)
1
2.34 s
4.85 s
2.34 s
flat
MATCH (org:Organization{tildaid:$scopeOrgId0}) CALL { WITH org UNWIND $lists.allowedStudies0 AS studyId OPTIONAL MATCH (study:Study) WHERE study.tildaid = studyId // An inactive actor carries no membership, so it is excluded here rather th…
MATCH (org:Organization{tildaid:$scopeOrgId0}) CALL { WITH org UNWIND $lists.allowedStudies0 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?Basic??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?')) OR EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:$signerUserId1}) }) AND (studyActor.isBlinded IS NULL OR doc1.blindedAccess = ? OR (studyActor.isBlinded = true AND (doc1.blindedAccess IN [?, ?])) OR (studyActor.isBlinded = false AND (doc1.blindedAccess IN [?, ?])))) WITH *, (($orgDocs0 AND doc1.studyId = ? AND doc1.patientId = ?) OR (doc1.studyId = ? AND true) OR CASE WHEN $orgDocs0 THEN EXISTS { (doc1)-[:BELONGS_TO]->(org) } ELSE false END) AS directAdmit CALL { WITH doc1, directAdmit WITH doc1 WHERE NOT directAdmit AND $withSigner0 AND EXISTS { (doc1)-[:HAS]-(:DocumentAnnotation)-[:ANNOTATION_SIGNER]-(:DocumentSigner{userId:$signerUserId2}) } RETURN doc1 as doc UNION WITH doc1, directAdmit WITH doc1 WHERE directAdmit RETURN doc1 as doc} WITH DISTINCT doc WITH doc, coalesce(doc.archived, false) as isArchived RETURN count(CASE WHEN NOT isArchived AND doc.stateTag = ? THEN ? END) as readyForTmf, count(CASE WHEN NOT isArchived AND doc.stateTag = ? THEN ? END) as needsCorrection, count(CASE WHEN NOT isArchived AND doc.stateTag = ? THEN ? END) as needsAttention, count(CASE WHEN NOT isArchived AND doc.stateTag = ? THEN ? END) as draft, count(CASE WHEN NOT isArchived AND doc.stateTag = ? THEN ? END) as aiReview, count(CASE WHEN NOT isArchived AND doc.stateTag = ? THEN ? END) as manual, count(CASE WHEN isArchived THEN ? END) as archived
docsvc
1
3.05 s
4.85 s
3.05 s
flat
UNWIND $userIds AS uid CALL (uid) { MATCH (:User{tildaid:uid})<-[:TRAINING_ASSIGNMENT_TO_USER]-(ta:TrainingAssignment{ownerOrgId:$orgId, deltimestamp:?}) WHERE coalesce(ta.studyId, ?) = ? AND (ta.state = $assignedState OR EXISTS { (ta)-[:P…
UNWIND $userIds AS uid CALL (uid) { MATCH (:User{tildaid:uid})<-[:TRAINING_ASSIGNMENT_TO_USER]-(ta:TrainingAssignment{ownerOrgId:$orgId, deltimestamp:?}) WHERE coalesce(ta.studyId, ?) = ? AND (ta.state = $assignedState OR EXISTS { (ta)-[:PARTICIPANT_ACTIVITY]->(done:ParticipantActivity{deltimestamp:?}) WHERE done.status IN $completedStatuses }) MATCH (training:Training{delpending:false})-[:TRAINING_TO_ASSIGNMENT]->(ta) WHERE (coalesce(training.scopeType, ?) = $orgScopeType) AND (training.orgId <> ? AND training.orgId = $orgId) RETURN ta, training, null AS study UNION MATCH (:User{tildaid:uid})<-[:TRAINING_ASSIGNMENT_TO_USER]-(ta:TrainingAssignment{deltimestamp:?}) WHERE ta.studyId IN $studyIds AND (ta.state = $assignedState OR EXISTS { (ta)-[:PARTICIPANT_ACTIVITY]->(done:ParticipantActivity{deltimestamp:?}) WHERE done.status IN $completedStatuses }) MATCH (training:Training{delpending:false})-[:TRAINING_TO_ASSIGNMENT]->(ta), (training)-[:PLAN_DEFINITION_TO_STUDY]->(study:Study{delpending:false}) WHERE study.tildaid = ta.studyId AND (NOT ((coalesce(training.siteScope, ?) = $studyTeamScope) OR (coalesce(training.scopeType, ?) = $orgScopeType)) OR (training.orgId <> ? AND training.orgId = $callerOrgId)) RETURN ta, training, study } CALL (ta) { OPTIONAL MATCH (ta)-[:PARTICIPANT_ACTIVITY]->(trainingPA:ParticipantActivity{deltimestamp:?}) WHERE CASE WHEN ta.state = $assignedState THEN NOT EXISTS { (trainingPA)-[:NEXT_PARTICIPANT_ACTIVITY]->() } ELSE trainingPA.status IN $completedStatuses AND NOT EXISTS { (trainingPA)-[:NEXT_PARTICIPANT_ACTIVITY*]->(newer:ParticipantActivity{deltimestamp:?}) WHERE newer.status IN $completedStatuses } END RETURN trainingPA ORDER BY trainingPA.createdat DESC LIMIT ? } WITH uid, training, ta, study, trainingPA WHERE trainingPA IS NOT NULL MATCH (trainingPA)-[:BELONGS_TO_ACTIVITY]->(trainingActivity:ActivityV2) CALL (trainingPA, trainingActivity) { OPTIONAL MATCH (trainingPA)-[:PARTICIPANT_QUESTIONNAIRE]-(tpPqnr:ParticipantQuestionnaire)-[:BELONGS_TO_QUESTIONNAIRE]-(tpQnr:QuestionnaireV2) WHERE exists((tpQnr)-[:GRAPH_TO_VARIABLE {graphid: tpQnr.tildaid, path: [tpQnr.tildaid]}]->(:VariableV2 {name: ?, type: ?})) WITH trainingPA, trainingActivity, tpPqnr IS NOT NULL AS tpIsQuiz, tpQnr.title AS tpTitle, tpPqnr.attempts AS tpAttempts, [(tpPqnr)-[:PARTICIPANT_VARIABLE]-(tpPv:ParticipantVariable)-[:BELONGS_TO_VARIABLE]-(tpVar:VariableV2) WHERE tpVar.name IN [?, ?, ?] | [tpVar.name, tpPv.value]] AS tpVals WITH trainingPA, trainingActivity, count(CASE WHEN any(x IN tpVals WHERE x[?] = ? AND coalesce(x[?], ?) <> ?) THEN ? END) AS tpFailed, sum(toInteger(coalesce([x IN tpVals WHERE x[?] = ? | x[?]][?], ?))) AS tpTotal, sum(toInteger(coalesce([x IN tpVals WHERE x[?] = ? | x[?]][?], ?))) AS tpTotalMax, collect(CASE WHEN tpIsQuiz THEN {title: tpTitle, attempts: coalesce(tpAttempts, ?), score: head([x IN tpVals WHERE x[?] = ? | x[?]]), max: head([x IN tpVals WHERE x[?] = ? | x[?]]), result: head([x IN tpVals WHERE x[?] = ? | x[?]])} END) AS tpQuizzes WITH trainingPA, trainingActivity, tpFailed, tpTotal, tpTotalMax, tpQuizzes, [q IN tpQuizzes | q.score] AS tpScores, [q IN tpQuizzes | q.max] AS tpMaxScores RETURN tpFailed = ? AND (trainingPA.status = ? OR coalesce(trainingActivity.passingScore, ?) = ? OR tpTotalMax = ? OR tpTotal * ? >= coalesce(trainingActivity.passingScore, ?) * tpTotalMax) AS trainingPassed, tpScores AS trainingScoreValues, tpMaxScores AS trainingMaxScoreValues } WITH uid, training, ta, study, trainingActivity, trainingPA, trainingPassed, trainingScoreValues, trainingMaxScoreValues, [(trainingPA)-[:ALL_CHANGELOG]->(cl:ChangeLog) WHERE cl.type = ? AND cl.newValue IN [?,?,?,?] | [cl.newValue, cl.createdat, cl.who, CASE WHEN cl.newValue = ? AND cl.blob STARTS WITH ? THEN coalesce(apoc.convert.fromJsonMap(cl.blob).completedAt, cl.createdat) ELSE cl.createdat END, cl.reason]] AS trainingLog ORDER BY training.name, training.tildaid RETURN uid, collect({activityId:trainingActivity.tildaid, activityTitle:trainingActivity.title, version:trainingActivity.version, paId:trainingPA.tildaid, paStatus:trainingPA.status, paUpdatedAt:trainingPA.updatedat, paCreatedAt:trainingPA.createdat, paDueDate:trainingPA.dueDate, trainingId:training.tildaid, trainingName:training.name, trainingStatus:training.status, validUntil:training.validUntil, validUntilUnits:training.validUntilUnits, assignmentState:ta.state, studyId:study.tildaid, studyName:study.name, passed:trainingPassed, scoreValues:trainingScoreValues, maxScoreValues:trainingMaxScoreValues, assignments:[x IN trainingLog WHERE x[?] IN [?,?] | [x[?], x[?]]], completions:[x IN trainingLog WHERE x[?] IN [?,?] | [x[?], x[?]]] }) AS trainingActivities
execsvc
1
3.19 s
4.85 s
3.19 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
1
2.01 s
4.85 s
2.01 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
1
3.88 s
4.85 s
3.88 s
flat
MATCH (n:Folder|SubArtifact) WHERE n.isArchived IS NULL SET n.isArchived = false RETURN count(n)
MATCH (n:Folder|SubArtifact) WHERE n.isArchived IS NULL SET n.isArchived = false RETURN count(n)
writedocsvc
1
3.41 s
4.85 s
3.41 s
flat
MATCH (task:Task) WHERE task.ufid IS NOT NULL AND task.ufid > ? AND (task.task_number IS NULL OR task.task_number = ?) SET task.task_number = task.ufid WITH task REMOVE task.ufid RETURN count(task) as migrated
MATCH (task:Task) WHERE task.ufid IS NOT NULL AND task.ufid > ? AND (task.task_number IS NULL OR task.task_number = ?) SET task.task_number = task.ufid WITH task REMOVE task.ufid RETURN count(task) as migrated
writetusker
2
2.93 s
4.70 s
4.49 s
flat
MATCH (n:GraphNode)-[r:GRAPH_NEXT]->(n) DELETE r
MATCH (n:GraphNode)-[r:GRAPH_NEXT]->(n) DELETE r
writestudiosvc
2
2.19 s
4.70 s
3.32 s
flat
match (user:User) where user.name contains ? return DISTINCT user.name;
match (user:User) where user.name contains ? return DISTINCT user.name;
(internal)
2
1.41 s
4.70 s
2.64 s
flat
MATCH (act:FormV2) WHERE act.type = ? AND (act.scopeid = ? OR act.scopeid IS NULL) AND (act.supportsglobalactivitybottomup IS NULL OR act.supportsglobalactivitybottomup = false) RETURN act.tildaid ORDER BY act.tildaid LIMIT ?
MATCH (act:FormV2) WHERE act.type = ? AND (act.scopeid = ? OR act.scopeid IS NULL) AND (act.supportsglobalactivitybottomup IS NULL OR act.supportsglobalactivitybottomup = false) RETURN act.tildaid ORDER BY act.tildaid LIMIT ?
studiosvc
2
3.04 s
4.70 s
4.92 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
chat-agent
3
1.04 s
4.55 s
2.61 s
9.7× ↑
MATCH (n:GraphNode)-[r:GRAPH_NEXT]->(n) DELETE r
MATCH (n:GraphNode)-[r:GRAPH_NEXT]->(n) DELETE r
writestudiosvc
3
1.76 s
4.55 s
2.13 s
flat
CALL { MATCH (d:Document) WHERE d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? // Certification is what triggers processing, so anything not yet certified // ha…
CALL { MATCH (d:Document) WHERE d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? // Certification is what triggers processing, so anything not yet certified // has not reached its trigger: a ZIP member still being extracted, or an // upload whose file has not landed. Starting one here races the writer // that will certify it. AND d.status = $certified_status AND NOT EXISTS { (d)<-[:AI_RUN_TO_DOCUMENT_LATEST]-(:AIRun) } RETURN d, null AS latest_ai UNION MATCH (ai:AIRun)-[:AI_RUN_TO_DOCUMENT_LATEST]->(d:Document) WHERE ai.status IN [?, ?] AND d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? AND d.status IN $retry_statuses WITH DISTINCT d MATCH (d)<-[:AI_RUN_TO_DOCUMENT_LATEST]-(run:AIRun) WITH d, run ORDER BY COALESCE(run.updatedat, run.createdat) DESC WITH d, collect(run)[?] AS latest_ai // The cap applies to both statuses: each backlog retry bumps auto_retry_count on // the run (and refreshes updatedat, which keeps an aborted run inside the adopt // path?Staging?Pre-Staging'] } MATCH (d)-[:DOC_TO_ORG]-(o:Organization{orgType:?}) WITH DISTINCT d, o, latest_ai WITH d.tildaid AS doc_id, o.tildaid AS org_id, o.alias AS org_alias, d.primaryVersionId AS version_id, d.studyId AS study_id, COALESCE(latest_ai.auto_retry_count, ?) AS current_retry_count, // null when latest_ai IS NULL — a document enabled but never run has no // originating request to recover, and a sentinel user is the honest answer there. latest_ai.request_info AS request_info, latest_ai.tildaid AS ai_run_id, d OPTIONAL MATCH (d)-[:UPLOADED_BY]->(uploader:User) WITH doc_id, org_id, org_alias, version_id, study_id, current_retry_count, request_info, ai_run_id, head(collect(uploader.email)) AS uploaded_by RETURN doc_id, org_id, org_alias, version_id, study_id, current_retry_count, request_info, ai_run_id, uploaded_by ORDER BY doc_id LIMIT $limit
docproc
1,838
1.27 s
4.35 s
6.32 s
4.6× ↑
CALL { MATCH (d:Document) WHERE d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? // Certification is what triggers processing, so anything not yet certified // ha…
CALL { MATCH (d:Document) WHERE d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? // Certification is what triggers processing, so anything not yet certified // has not reached its trigger: a ZIP member still being extracted, or an // upload whose file has not landed. Starting one here races the writer // that will certify it. AND d.status = $certified_status AND NOT EXISTS { (d)<-[:AI_RUN_TO_DOCUMENT_LATEST]-(:AIRun) } RETURN d, null AS latest_ai UNION MATCH (ai:AIRun)-[:AI_RUN_TO_DOCUMENT_LATEST]->(d:Document) WHERE ai.status IN [?, ?] AND d.delpending = false AND d.aiEnabled = true AND d.studyId <> ? AND d.primaryVersionId IS NOT NULL AND d.primaryVersionId <> ? AND d.status IN $retry_statuses WITH DISTINCT d MATCH (d)<-[:AI_RUN_TO_DOCUMENT_LATEST]-(run:AIRun) WITH d, run ORDER BY COALESCE(run.updatedat, run.createdat) DESC WITH d, collect(run)[?] AS latest_ai // The cap applies to both statuses: each backlog retry bumps auto_retry_count on // the run (and refreshes updatedat, which keeps an aborted run inside the adopt // path?Staging?Pre-Staging'] } MATCH (d)-[:DOC_TO_ORG]-(o:Organization{orgType:?}) WITH DISTINCT d, o, latest_ai WITH d RETURN count(d) AS total
docproc
11,162
1.22 s
4.28 s
26.49 s
4.6× ↑
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL { WITH u, o, c // scope=Study policies=study-config-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 { WITH u, o, c // scope=Study policies=study-config-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 WITH u, o, c // scope=Study policies=study-config-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_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 UNION WITH u, o, c // scope=Organization policies=org-study-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_2 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-study-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_3 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
enrollsvc
5
546 ms
4.25 s
2.71 s
flat
match (n:Smo{orgId:$orgId})-[:PLAN_DEFINITION_TO_SMO]-(pd:DslPlanDefinition{studyId:$studyId,delpending:false}) return pd
match (n:Smo{orgId:$orgId})-[:PLAN_DEFINITION_TO_SMO]-(pd:DslPlanDefinition{studyId:$studyId,delpending:false}) return pd
regsvc
5
536 ms
4.25 s
2.64 s
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
564 ms
4.25 s
2.79 s
flat
MATCH (proto:FormV2 {tildaid: $protoId})-[pr:PROTOCOL_TO_GRAPH_NODE_REF]->(ref:GraphNodeRef) MATCH (ref)-[:GRAPH_NODE_REF_TO_GRAPH_NODE|GRAPH_NODE_REF_TO_QUESTION {protocolid: $protoId}]->(target) WHERE (target:QuestionV2 OR target:Respons…
MATCH (proto:FormV2 {tildaid: $protoId})-[pr:PROTOCOL_TO_GRAPH_NODE_REF]->(ref:GraphNodeRef) MATCH (ref)-[:GRAPH_NODE_REF_TO_GRAPH_NODE|GRAPH_NODE_REF_TO_QUESTION {protocolid: $protoId}]->(target) WHERE (target:QuestionV2 OR target:ResponseSet OR target:FormV2) AND target.tildaid IN $targetIds RETURN target.tildaid AS tid, ref.tildaid AS refId, pr.path AS path
studiosvc
17
1.60 s
4.15 s
3.99 s
flat
MATCH (org:Organization{tildaid:$scopeOrgId0}) CALL { WITH org UNWIND $lists.allowedStudies0 AS studyId OPTIONAL MATCH (study:Study) WHERE study.tildaid = studyId // An inactive actor carries no membership, so it is excluded here rather th…
MATCH (org:Organization{tildaid:$scopeOrgId0}) CALL { WITH org UNWIND $lists.allowedStudies0 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?Basic??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 DISTINCT doc WITH doc, coalesce(doc.archived, false) as isArchived RETURN count(CASE WHEN NOT isArchived AND doc.stateTag = ? THEN ? END) as readyForTmf, count(CASE WHEN NOT isArchived AND doc.stateTag = ? THEN ? END) as needsCorrection, count(CASE WHEN NOT isArchived AND doc.stateTag = ? THEN ? END) as needsAttention, count(CASE WHEN NOT isArchived AND doc.stateTag = ? THEN ? END) as draft, count(CASE WHEN NOT isArchived AND doc.stateTag = ? THEN ? END) as aiReview, count(CASE WHEN NOT isArchived AND doc.stateTag = ? THEN ? END) as manual, count(CASE WHEN isArchived THEN ? END) as archived
docsvc
8
644 ms
3.80 s
4.87 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
10
462 ms
3.50 s
2.16 s
9.7× ↑
MATCH (m:TildaDataMigration {id: $id}) RETURN m.status = $applied
MATCH (m:TildaDataMigration {id: $id}) RETURN m.status = $applied
execsvc
10
299 ms
3.50 s
2.98 s
flat
MATCH (b:Budget) WHERE b.status = ? AND date(b.effectiveDate) <= date() RETURN b.tildaid
MATCH (b:Budget) WHERE b.status = ? AND date(b.effectiveDate) <= date() RETURN b.tildaid
finsvc
10
333 ms
3.50 s
3.30 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
10
402 ms
3.50 s
3.61 s
flat
MATCH (:CarePlan {tildaid:?})-[:PARTICIPANT_ACTIVITY]->(pa:ParticipantActivity)-[:BELONGS_TO_ACTIVITY]->(:ActivityV2 {title:?}) MATCH (pa)-[:PARTICIPANT_QUESTIONNAIRE]->(:ParticipantQuestionnaire)-[:PARTICIPANT_TABLE]->(:ParticipantTable {…
MATCH (:CarePlan {tildaid:?})-[:PARTICIPANT_ACTIVITY]->(pa:ParticipantActivity)-[:BELONGS_TO_ACTIVITY]->(:ActivityV2 {title:?}) MATCH (pa)-[:PARTICIPANT_QUESTIONNAIRE]->(:ParticipantQuestionnaire)-[:PARTICIPANT_TABLE]->(:ParticipantTable {tableId:?})-[:PARTICIPANT_QUESTION]->(pq:ParticipantQuestion) WHERE pq.hdmClassId IN [?,?] MATCH (qn:QuestionV2 {tildaid: pq.questionId}) RETURN pq.hdmClassId AS row, qn.title AS question, pq.value AS value, pq.status AS status, EXISTS { (qn)<-[:GRAPH_NODE_REF_TO_QUESTION]-(:GraphNodeRef) } AS inAnyForm ORDER BY row, question
(internal)
1
1.02 s
1.95 s
1.02 s
flat
MATCH (cp:CarePlan)-[:EXECUTE_SOA]->(:ScheduleOfActivities)-[:SOA_TO_PROTOCOL_VERSION]->(a:ProtocolVersionV2) WHERE coalesce(cp.mode,?) = ? OR cp.mode <> ? MATCH (st:Study {tildaid: cp.studyId}) WHERE NOT toLower(st.name) =~ ? AND EXISTS {…
MATCH (cp:CarePlan)-[:EXECUTE_SOA]->(:ScheduleOfActivities)-[:SOA_TO_PROTOCOL_VERSION]->(a:ProtocolVersionV2) WHERE coalesce(cp.mode,?) = ? OR cp.mode <> ? MATCH (st:Study {tildaid: cp.studyId}) WHERE NOT toLower(st.name) =~ ? AND EXISTS { (st)-[:STUDY_TO_ORG]->(o:Organization) WHERE NOT toLower(o.name) =~ ? AND NOT o.name =~ ? } CALL (cp) { MATCH (cp)-[:CAREPLAN_TO_ALL_PARTICIPANTVISITS]->(:ParticipantVisit)-[:PARTICIPANT_ACTIVITY]->(pa:ParticipantActivity) RETURN pa UNION MATCH (cp)-[:PARTICIPANT_ACTIVITY]->(pa:ParticipantActivity) RETURN pa } WITH st, cp, count(CASE WHEN (pa.status IN [?,?] OR pa.edcStatus IN [?,?]) THEN ? END) AS done RETURN count(DISTINCT st) AS studies, count(DISTINCT cp) AS careplans, sum(done) AS completedPAs, max(done) AS maxPerCp
(internal)
1
1.39 s
1.95 s
1.39 s
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
1
1.21 s
1.95 s
1.21 s
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
1.91 s
1.95 s
1.96 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-study-read MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role), (o)-[:ORGAN…
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-study-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 (o)<-[:STUDY_TO_ORG]-(st:Study {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-study-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, ?), ?) MATCH (o)<-[:STUDY_TO_ORG]-(st:Study {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
enrollsvc
1
1.39 s
1.95 s
1.39 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
1
1.50 s
1.95 s
1.50 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 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, ?), ?) 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
1
1.26 s
1.95 s
1.26 s
flat
MATCH (u:User) WHERE NOT EXISTS ((:Inbox)-[:OWNED_BY]->(u)) MERGE (i:Inbox {type:?, name: u.email, deltimestamp:?})-[r:OWNED_BY]->(u) ON CREATE SET i.createdat = timestamp(), i.tildaid = apoc.create.uuid(), r.createdat = timestamp(), r.til…
MATCH (u:User) WHERE NOT EXISTS ((:Inbox)-[:OWNED_BY]->(u)) MERGE (i:Inbox {type:?, name: u.email, deltimestamp:?})-[r:OWNED_BY]->(u) ON CREATE SET i.createdat = timestamp(), i.tildaid = apoc.create.uuid(), r.createdat = timestamp(), r.tildaid = apoc.create.uuid() RETURN COUNT(i)
writetusker
1
1.10 s
1.95 s
1.10 s
flat
UNWIND $userIds AS uid CALL (uid) { MATCH (:User{tildaid:uid})<-[:TRAINING_ASSIGNMENT_TO_USER]-(ta:TrainingAssignment{ownerOrgId:$orgId, deltimestamp:?}) WHERE coalesce(ta.studyId, ?) = ? AND (ta.state = $assignedState OR EXISTS { (ta)-[:P…
UNWIND $userIds AS uid CALL (uid) { MATCH (:User{tildaid:uid})<-[:TRAINING_ASSIGNMENT_TO_USER]-(ta:TrainingAssignment{ownerOrgId:$orgId, deltimestamp:?}) WHERE coalesce(ta.studyId, ?) = ? AND (ta.state = $assignedState OR EXISTS { (ta)-[:PARTICIPANT_ACTIVITY]->(done:ParticipantActivity{deltimestamp:?}) WHERE done.status IN $completedStatuses }) MATCH (training:Training{delpending:false})-[:TRAINING_TO_ASSIGNMENT]->(ta) WHERE (coalesce(training.scopeType, ?) = $orgScopeType) AND (training.orgId <> ? AND training.orgId = $orgId) RETURN ta, training, null AS study UNION MATCH (:User{tildaid:uid})<-[:TRAINING_ASSIGNMENT_TO_USER]-(ta:TrainingAssignment{deltimestamp:?}) WHERE ta.studyId IN $studyIds AND (ta.state = $assignedState OR EXISTS { (ta)-[:PARTICIPANT_ACTIVITY]->(done:ParticipantActivity{deltimestamp:?}) WHERE done.status IN $completedStatuses }) AND (ta.ownerOrgId = $viewerOrgId OR $viewerOrgId IN ta.deliveredOrgIds) MATCH (training:Training{delpending:false})-[:TRAINING_TO_ASSIGNMENT]->(ta), (training)-[:PLAN_DEFINITION_TO_STUDY]->(study:Study{delpending:false}) WHERE study.tildaid = ta.studyId AND (NOT ((coalesce(training.siteScope, ?) = $studyTeamScope) OR (coalesce(training.scopeType, ?) = $orgScopeType)) OR (training.orgId <> ? AND training.orgId = $callerOrgId)) RETURN ta, training, study } CALL (ta) { OPTIONAL MATCH (ta)-[:PARTICIPANT_ACTIVITY]->(trainingPA:ParticipantActivity{deltimestamp:?}) WHERE CASE WHEN ta.state = $assignedState THEN NOT EXISTS { (trainingPA)-[:NEXT_PARTICIPANT_ACTIVITY]->() } ELSE trainingPA.status IN $completedStatuses AND NOT EXISTS { (trainingPA)-[:NEXT_PARTICIPANT_ACTIVITY*]->(newer:ParticipantActivity{deltimestamp:?}) WHERE newer.status IN $completedStatuses } END RETURN trainingPA ORDER BY trainingPA.createdat DESC LIMIT ? } WITH uid, training, ta, study, trainingPA WHERE trainingPA IS NOT NULL MATCH (trainingPA)-[:BELONGS_TO_ACTIVITY]->(trainingActivity:ActivityV2) CALL (trainingPA, trainingActivity) { OPTIONAL MATCH (trainingPA)-[:PARTICIPANT_QUESTIONNAIRE]-(tpPqnr:ParticipantQuestionnaire)-[:BELONGS_TO_QUESTIONNAIRE]-(tpQnr:QuestionnaireV2) WHERE exists((tpQnr)-[:GRAPH_TO_VARIABLE {graphid: tpQnr.tildaid, path: [tpQnr.tildaid]}]->(:VariableV2 {name: ?, type: ?})) WITH trainingPA, trainingActivity, tpPqnr IS NOT NULL AS tpIsQuiz, tpQnr.title AS tpTitle, tpPqnr.attempts AS tpAttempts, tpPqnr.gradedQuestionCount AS tpGraded, tpPqnr.correctQuestionCount AS tpCorrect, [(tpPqnr)-[:PARTICIPANT_VARIABLE]-(tpPv:ParticipantVariable)-[:BELONGS_TO_VARIABLE]-(tpVar:VariableV2) WHERE tpVar.name IN [?, ?, ?] | [tpVar.name, tpPv.value]] AS tpVals WITH trainingPA, trainingActivity, count(CASE WHEN any(x IN tpVals WHERE x[?] = ? AND coalesce(x[?], ?) <> ?) THEN ? END) AS tpFailed, sum(toInteger(coalesce([x IN tpVals WHERE x[?] = ? | x[?]][?], ?))) AS tpTotal, sum(toInteger(coalesce([x IN tpVals WHERE x[?] = ? | x[?]][?], ?))) AS tpTotalMax, collect(CASE WHEN tpIsQuiz THEN {title: tpTitle, attempts: coalesce(tpAttempts, ?), graded: tpGraded, correct: tpCorrect, score: head([x IN tpVals WHERE x[?] = ? | x[?]]), max: head([x IN tpVals WHERE x[?] = ? | x[?]]), result: head([x IN tpVals WHERE x[?] = ? | x[?]])} END) AS tpQuizzes WITH trainingPA, trainingActivity, tpFailed, tpTotal, tpTotalMax, tpQuizzes, [q IN tpQuizzes | q.score] AS tpScores, [q IN tpQuizzes | q.max] AS tpMaxScores RETURN tpFailed = ? AND (trainingPA.status = ? OR coalesce(trainingActivity.passingScore, ?) = ? OR tpTotalMax = ? OR tpTotal * ? >= coalesce(trainingActivity.passingScore, ?) * tpTotalMax) AS trainingPassed, tpScores AS trainingScoreValues, tpMaxScores AS trainingMaxScoreValues } WITH uid, training, ta, study, trainingActivity, trainingPA, trainingPassed, trainingScoreValues, trainingMaxScoreValues, [(trainingPA)-[:ALL_CHANGELOG]->(cl:ChangeLog) WHERE cl.type = ? AND cl.newValue IN [?,?,?,?] | [cl.newValue, cl.createdat, cl.who, CASE WHEN cl.newValue = ? AND cl.blob STARTS WITH ? THEN coalesce(apoc.convert.fromJsonMap(cl.blob).completedAt, cl.createdat) ELSE cl.createdat END, cl.reason]] AS trainingLog ORDER BY training.name, training.tildaid RETURN uid, collect({activityId:trainingActivity.tildaid, activityTitle:trainingActivity.title, version:trainingActivity.version, paId:trainingPA.tildaid, paStatus:trainingPA.status, paUpdatedAt:trainingPA.updatedat, paCreatedAt:trainingPA.createdat, paDueDate:trainingPA.dueDate, trainingId:training.tildaid, trainingName:training.name, trainingStatus:training.status, validUntil:training.validUntil, validUntilUnits:training.validUntilUnits, assignmentState:ta.state, studyId:study.tildaid, studyName:study.name, passed:trainingPassed, scoreValues:trainingScoreValues, maxScoreValues:trainingMaxScoreValues, assignments:[x IN trainingLog WHERE x[?] IN [?,?] | [x[?], x[?]]], completions:[x IN trainingLog WHERE x[?] IN [?,?] | [x[?], x[?]]] }) AS trainingActivities
execsvc
1
1.25 s
1.95 s
1.25 s
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
1
1.99 s
1.95 s
1.99 s
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
1.05 s
1.94 s
1.14 s
flat
MATCH (ssa:StudySiteActor {delpending:false}) WHERE ssa.location IS NULL OR ssa.location = ? SET ssa.location = ?
MATCH (ssa:StudySiteActor {delpending:false}) WHERE ssa.location IS NULL OR ssa.location = ? SET ssa.location = ?
writeexecsvc
3
1.11 s
1.92 s
1.32 s
flat
MATCH (proto:FormV2 {tildaid: $protoId})-[pr:PROTOCOL_TO_GRAPH_NODE_REF]->(ref:GraphNodeRef) MATCH (ref)-[:GRAPH_NODE_REF_TO_GRAPH_NODE|GRAPH_NODE_REF_TO_QUESTION {protocolid: $protoId}]->(target) WHERE (target:QuestionV2 OR target:Respons…
MATCH (proto:FormV2 {tildaid: $protoId})-[pr:PROTOCOL_TO_GRAPH_NODE_REF]->(ref:GraphNodeRef) MATCH (ref)-[:GRAPH_NODE_REF_TO_GRAPH_NODE|GRAPH_NODE_REF_TO_QUESTION {protocolid: $protoId}]->(target) WHERE (target:QuestionV2 OR target:ResponseSet OR target:FormV2) AND target.tildaid IN $targetIds RETURN target.tildaid AS tid, ref.tildaid AS refId, pr.path AS path
studiosvc
2
1.02 s
1.90 s
1.07 s
flat
MATCH (s:Study)-[r:STUDY_TO_ACTOR]->(a:Actor) WHERE r.applyToStudyRoleFlag = false MATCH (s)-[r2:STUDY_TO_ACTOR]->(a) WHERE id(r2) <> id(r) DELETE r
MATCH (s:Study)-[r:STUDY_TO_ACTOR]->(a:Actor) WHERE r.applyToStudyRoleFlag = false MATCH (s)-[r2:STUDY_TO_ACTOR]->(a) WHERE id(r2) <> id(r) DELETE r
writeexecsvc
3
550 ms
1.85 s
1.02 s
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).