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
stored29h agotop 80 of 825
Neo4j query shapes on production over the last 3d, grouped by plan hash.
Click a column to sort; p95 drift (late-half ÷ early-half of the window) ranks the queries getting slower.
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
18,566
5.77 s
22.81 s
41.69 s
0.8× ↓
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,461
3.49 s
18.65 s
36.33 s
flat
MATCH (u:User {tildaid:$user}) OPTIONAL MATCH (o:Organization {alias:$org}) UNWIND $lists.checks AS c CALL (u, o, c) { // scope=Study policies=study-config-edit,study-config-read MATCH (u)<-[:FOR_USER]-(a:Actor)-[:APPOINTED_AS]->(x:Role) W…
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,study-config-read 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,study-config-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, ?), ?) 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
exportsvc
1
2.20 s
4.85 s
2.20 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
575 ms
1.90 s
1.14 s
0.0× ↓
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
916
629 ms
976 ms
1.02 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
127
750 ms
975 ms
898 ms
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
854
750 ms
975 ms
929 ms
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
150
626 ms
975 ms
955 ms
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
948
764 ms
975 ms
944 ms
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
870
604 ms
975 ms
778 ms
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
126
599 ms
975 ms
701 ms
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
97
761 ms
975 ms
796 ms
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??Inactive? ?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
37
139 ms
769 ms
669 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
10
66 ms
750 ms
624 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
10
80 ms
750 ms
753 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
10
79 ms
750 ms
742 ms
flat
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {de…
OPTIONAL MATCH (u:User {tildaid: $userId}) CALL { WITH u MATCH (u)<-[:FOR_USER]-(:Actor {delpending: false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)-[:SUPPORTS_ORG]-(o:Organization {delpending: false}) RETURN o UNION WITH u MATCH (u)<-[:FOR_USER]-(da:Actor {delpending: false})<-[:STUDY_TO_DELEGATED_ACTOR]-(dst:Study {delpending: false})-[:STUDY_TO_ORG]->(o:Organization {delpending: false}), (da)-[:APPOINTED_AS]->(dr:Role)<-[:APPOINTED_AS]-(sa:Actor {delpending: false}), (da)-[:DELEGATED_FROM]->(sa)<-[:ORGANIZATION_TO_ACTOR]-(:Organization {alias: $tildaScaleAlias}) WHERE dst.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(dr.tags, ?), ?) RETURN o UNION WITH u MATCH (o:Organization {alias: $activeAlias, delpending: false}) RETURN o } OPTIONAL MATCH (st:Study {delpending: false})-[:STUDY_TO_ORG]->(o) RETURN collect(DISTINCT o.alias) AS aliases, collect(DISTINCT o.tildaid) AS orgIds, collect(DISTINCT st.tildaid) AS studyIds
dashql
10
86 ms
750 ms
819 ms
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
462 ms
485 ms
469 ms
flat
MATCH(org:Organization{tildaid:$orgId})-[:ORGANIZATION_TO_PATIENT]-(p:Patient{tildaid:$id}) OPTIONAL MATCH (p)-[r:INTERESTED_CONDITIONS]->(cond:AdvCampaignCondition) with p, collect(cond.tildaid) as condIds OPTIONAL MATCH (p)-[:HAS_PROTECT…
MATCH(org:Organization{tildaid:$orgId})-[:ORGANIZATION_TO_PATIENT]-(p:Patient{tildaid:$id}) OPTIONAL MATCH (p)-[r:INTERESTED_CONDITIONS]->(cond:AdvCampaignCondition) with p, collect(cond.tildaid) as condIds OPTIONAL MATCH (p)-[:HAS_PROTECTED_DATA_IN]-(phi:Phi) OPTIONAL MATCH (p)<-[:RESEARCH_SUBJECT]-(cp:CarePlan)-[:EXECUTE_SOA]-(:ScheduleOfActivities)-[:SOA_TO_PLAN_DEFINITION]-(pd:DslPlanDefinition)-[:PLAN_DEFINITION_TO_STUDY]-(st:Study) OPTIONAL MATCH (pd)-[:PLAN_DEFINITION_TO_SITE]-(si:Site) WITH p, phi,condIds, cp, st, si ORDER BY st.name ASC WITH p, phi,condIds, collect({cp: cp, st: st, site:si}) AS cpStudyPairs OPTIONAL MATCH (s:Study)<-[:LEAD_TO_STUDY]-(l:Lead)-[:LEAD_TO_PATIENT]->(p) WITH p, phi,condIds, cpStudyPairs, l, s ORDER BY s.name ASC WITH p, phi,condIds, cpStudyPairs, collect({l: l, s: s}) AS lStudyPairs // Combine studyInfo and leadStudyInfo, ignoring leadStudyInfo if studyId matches WITH p, phi,condIds, cpStudyPairs, lStudyPairs, [pair IN cpStudyPairs WHERE pair.st IS NOT NULL OR pair.cp IS NOT NULL | { id: pair.st.tildaid, name: pair.st.name, sponsor: pair.st.sponsor, careplanId: pair.cp.tildaid, cpstatus: pair.cp.status, site: pair.site.name, subjectid: pair.cp.subjectid, isLocked: coalesce(pair.st.isLocked, false) } ] AS studyInfo, [pair IN lStudyPairs WHERE pair.s IS NOT NULL AND NOT pair.s.tildaid IN [cpPair IN cpStudyPairs WHERE cpPair.st IS NOT NULL | cpPair.st.tildaid] | { id: pair.s.tildaid, name: pair.s.name, sponsor: pair.s.sponsor, lstatus: pair.l.status, leadId: pair.l.tildaid, isLocked: coalesce(pair.s.isLocked, false) } ] AS leadStudyInfo WITH p, phi, condIds,studyInfo + leadStudyInfo AS combinedStudyInfo CALL apoc.create.vNode( [?], { patientId: p.tildaid, preferredLanguage: p.preferredlanguage, contactpreference: p.contactpreference, timepreference: p.timepreference, gender: p.sex, phiId: phi.tildaid, dob: phi.dob, firstname: phi.firstname, middlename: phi.middlename, lastname: phi.lastname, nickname: phi.nickname, suffix: phi.suffix, preferredname: phi.preferredname, address1: phi.address1, address2: phi.address2, city: phi.city, state: phi.state, country: phi.country, zippostalcode: phi.zippostalcode, latitude: phi.latitude, longitude: phi.longitude, email: phi.email, homephone: phi.homephone, workphone: phi.workphone, mobilephone: phi.mobilephone, primaryphonetype: phi.primaryphonetype, secondaryphonetype: phi.secondaryphonetype, emergencycontactname: phi.emergencycontactname, emergencycontactphonenumber: phi.emergencycontactphonenumber, emergencycontactrelation: phi.emergencycontactrelation, emergencycontactemail: phi.emergencycontactemail, hasStudyPartner: phi.hasstudypartner, studyPartnerName: phi.studypartnername, studyPartnerRelation: phi.studypartnerrelation, studyPartnerIsEmergencyContact: phi.studypartnerisemergencycontact, studyPartnerAddress1: phi.studypartneraddress1, studyPartnerAddress2: phi.studypartneraddress2, studyPartnerCity: phi.studypartnercity, studyPartnerState: phi.studypartnerstate, studyPartnerZipCode: phi.studypartnerzipcode, studyPartnerCountry: phi.studypartnercountry, studyPartnerEmail: phi.studypartneremail, studyPartnerPhone: phi.studypartnerphone, interestedconditionids: condIds, studyInfo: combinedStudyInfo }) YIELD node AS vNodes WITH COLLECT(vNodes) as profiles UNWIND profiles AS allprofiles RETURN allprofiles
writepatientsvc
1
259 ms
485 ms
259 ms
flat
MATCH (study:Study )-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE NOT EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) AND EXISTS((study)-[:STUDY_TO_ORG{inherited:false}]-(:Organization{orgType:?})) CALL { WITH t MATCH (t)<-[:CREATED_FRO…
MATCH (study:Study )-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE NOT EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) AND EXISTS((study)-[:STUDY_TO_ORG{inherited:false}]-(:Organization{orgType:?})) CALL { WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantControl)-[:PARTICIPANT_CONTROL]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw UNION ALL WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw } WITH DISTINCT study, t, ptc, pw MATCH (t)-[:BELONGS_TO]-(:Inbox)-[:MANAGED_BY]-(o:Organization) MATCH (ptc)-[:BELONGS_TO_TASKCONFIG]-(tc:TaskConfig) OPTIONAL MATCH (t)-[:BELONGS_TO]-(taskInbox:Inbox{type:?})--(taskUser:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:StudySiteActor)-[:STUDYSITEACTOR_TO_ACTOR]-(:Actor{delpending:false})-[:FOR_USER]-(user:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(scopeSite:Site)-[:SITE_TO_SMO]-(:Smo)-[:IS_AN_ORG]-(o) WITH DISTINCT study, t, o, tc, taskInbox, taskUser, user, scopeSite SKIP $skip LIMIT $limit WITH collect({study:study, t:t, o:o, tc:tc, taskInbox:taskInbox, taskUser:taskUser, user:user, scopeSite:scopeSite}) AS rows, collect(DISTINCT study) AS studies, collect(DISTINCT o) AS orgs, collect(DISTINCT scopeSite) AS sites CALL { WITH studies UNWIND studies AS study OPTIONAL MATCH (study)-[:STUDY_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(r:Role) WHERE r.name IN [?, ?, ?] RETURN study.tildaid AS studyId, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS piTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS smoTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS raTildaid } WITH rows, orgs, sites, collect({studyId: studyId, pi: piTildaid, smo: smoTildaid, ra: raTildaid}) AS studyRoles CALL { WITH orgs UNWIND orgs AS o OPTIONAL MATCH (o)-[:ORGANIZATION_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN o.tildaid AS orgId, collect(DISTINCT u.tildaid) AS adminTildaid } WITH rows, sites, studyRoles, collect({orgId: orgId, admin: adminTildaid}) AS orgRoles CALL { WITH sites UNWIND (CASE WHEN size(sites) = ? THEN [null] ELSE sites END) AS scopeSite OPTIONAL MATCH (scopeSite)-[:STAFF_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN scopeSite.tildaid AS siteId, collect(DISTINCT u.tildaid) AS siteAdminTildaid } WITH rows, studyRoles, orgRoles, collect({siteId: siteId, admin: siteAdminTildaid}) AS siteRoles UNWIND rows AS row WITH row, [x IN studyRoles WHERE x.studyId = row.study.tildaid][?] AS sr, [x IN orgRoles WHERE x.orgId = row.o.tildaid][?] AS orr, [x IN siteRoles WHERE row.scopeSite IS NOT NULL AND x.siteId = row.scopeSite.tildaid][?] AS str RETURN DISTINCT row.t AS task, apoc.convert.toJson({userTildaid: row.user.tildaid, userName: row.user.name, PITildaid: sr.pi, studyOwnerTildaid: sr.smo, regAnalystTildaid: sr.ra, orgAdminTildaid: orr.admin, studyName: row.study.name, siteName: row.scopeSite.name, siteAdminTildaid: CASE WHEN row.scopeSite IS NULL THEN [] ELSE str.admin END}) AS details, row.tc.who AS dsnWho, row.o.alias AS orgAlias, row.taskInbox, row.taskUser.tildaid AS taskUserId
tusker
1
276 ms
485 ms
276 ms
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 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, count(CASE WHEN NOT isArchived AND coalesce(doc.stateTag, ?) <> ? THEN ? END) as all
docsvc
9
250 ms
485 ms
262 ms
flat
call { match (task:Task{assignment:?}) where (task.state = ? or task.state = ?) return task } with task where not exists ( (task)-[:CREATED_FROM_SPEC]-(:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_…
call { match (task:Task{assignment:?}) where (task.state = ? or task.state = ?) 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
7
309 ms
479 ms
443 ms
flat
call { match (task:Task{assignment:?}) where (task.state = ? or task.state = ?) return task } with task where not exists ( (task)-[:CREATED_FROM_SPEC]-(:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_…
call { match (task:Task{assignment:?}) where (task.state = ? or task.state = ?) 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
9
288 ms
477 ms
433 ms
flat
MATCH (study:Study )-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE NOT EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) AND EXISTS((study)-[:STUDY_TO_ORG{inherited:false}]-(:Organization{orgType:?})) CALL { WITH t MATCH (t)<-[:CREATED_FRO…
MATCH (study:Study )-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE NOT EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) AND EXISTS((study)-[:STUDY_TO_ORG{inherited:false}]-(:Organization{orgType:?})) CALL { WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantControl)-[:PARTICIPANT_CONTROL]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw UNION ALL WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw } WITH DISTINCT study, t, ptc, pw MATCH (t)-[:BELONGS_TO]-(:Inbox)-[:MANAGED_BY]-(o:Organization) MATCH (ptc)-[:BELONGS_TO_TASKCONFIG]-(tc:TaskConfig) OPTIONAL MATCH (t)-[:BELONGS_TO]-(taskInbox:Inbox{type:?})--(taskUser:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:StudySiteActor)-[:STUDYSITEACTOR_TO_ACTOR]-(:Actor{delpending:false})-[:FOR_USER]-(user:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(scopeSite:Site)-[:SITE_TO_SMO]-(:Smo)-[:IS_AN_ORG]-(o) WITH DISTINCT study, t, o, tc, taskInbox, taskUser, user, scopeSite SKIP $skip LIMIT $limit WITH collect({study:study, t:t, o:o, tc:tc, taskInbox:taskInbox, taskUser:taskUser, user:user, scopeSite:scopeSite}) AS rows, collect(DISTINCT study) AS studies, collect(DISTINCT o) AS orgs, collect(DISTINCT scopeSite) AS sites CALL { WITH studies UNWIND studies AS study OPTIONAL MATCH (study)-[:STUDY_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(r:Role) WHERE r.name IN [?, ?, ?] RETURN study.tildaid AS studyId, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS piTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS smoTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS raTildaid } WITH rows, orgs, sites, collect({studyId: studyId, pi: piTildaid, smo: smoTildaid, ra: raTildaid}) AS studyRoles CALL { WITH orgs UNWIND orgs AS o OPTIONAL MATCH (o)-[:ORGANIZATION_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN o.tildaid AS orgId, collect(DISTINCT u.tildaid) AS adminTildaid } WITH rows, sites, studyRoles, collect({orgId: orgId, admin: adminTildaid}) AS orgRoles CALL { WITH sites UNWIND (CASE WHEN size(sites) = ? THEN [null] ELSE sites END) AS scopeSite OPTIONAL MATCH (scopeSite)-[:STAFF_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN scopeSite.tildaid AS siteId, collect(DISTINCT u.tildaid) AS siteAdminTildaid } WITH rows, studyRoles, orgRoles, collect({siteId: siteId, admin: siteAdminTildaid}) AS siteRoles UNWIND rows AS row WITH row, [x IN studyRoles WHERE x.studyId = row.study.tildaid][?] AS sr, [x IN orgRoles WHERE x.orgId = row.o.tildaid][?] AS orr, [x IN siteRoles WHERE row.scopeSite IS NOT NULL AND x.siteId = row.scopeSite.tildaid][?] AS str RETURN DISTINCT row.t AS task, apoc.convert.toJson({userTildaid: row.user.tildaid, userName: row.user.name, PITildaid: sr.pi, studyOwnerTildaid: sr.smo, regAnalystTildaid: sr.ra, orgAdminTildaid: orr.admin, studyName: row.study.name, siteName: row.scopeSite.name, siteAdminTildaid: CASE WHEN row.scopeSite IS NULL THEN [] ELSE str.admin END}) AS details, row.tc.who AS dsnWho, row.o.alias AS orgAlias, row.taskInbox, row.taskUser.tildaid AS taskUserId
tusker
3
244 ms
477 ms
360 ms
flat
call { match (task:Task{assignment:?}) where (task.state = ? or task.state = ?) return task } with task where not exists ( (task)-[:CREATED_FROM_SPEC]-(:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_…
call { match (task:Task{assignment:?}) where (task.state = ? or task.state = ?) 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
8
254 ms
470 ms
403 ms
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
9
210 ms
466 ms
277 ms
flat
call { match (task:Task{assignment:?}) where (task.state = ? or task.state = ?) return task } with task where not exists ( (task)-[:CREATED_FROM_SPEC]-(:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_…
call { match (task:Task{assignment:?}) where (task.state = ? or task.state = ?) 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
7
198 ms
447 ms
333 ms
flat
MATCH (u:User) WHERE u.tildaid IN $userIds AND u.status<>?OPTIONAL MATCH (u)-[:INTERNAL_DATA]-(ui:UserInternal) WITH u, COALESCE(ui.pinHash IS NOT NULL AND ui.pinHash <> ?, false) AS pinSet, COALESCE(ui.needs2Factor, false) AS needs2Factor…
MATCH (u:User) WHERE u.tildaid IN $userIds AND u.status<>?OPTIONAL MATCH (u)-[:INTERNAL_DATA]-(ui:UserInternal) WITH u, COALESCE(ui.pinHash IS NOT NULL AND ui.pinHash <> ?, false) AS pinSet, COALESCE(ui.needs2Factor, false) AS needs2Factor WITH u, u{.*, pinSet: pinSet, needs2Factor: needs2Factor} as profile CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization{tildaid:$orgId, delpending:false}) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, a, r order by r.displayName WITH u, o, a, apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, orgType: o.orgType, status: o.status, startDate: a.startDate, endDate: a.endDate, capabilities: u.capabilities, role: roles, displayRoles: displayRoles, logoDocumentId: o.logoDocumentId, theme: o.theme, logoURL: o.logoURL, pinCheckEnabled: o.pinCheckEnabled }) AS organizations } CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false,orgId:$orgId})<-[:STUDY_TO_ACTOR]-(s:Study{delpending:false}) WITH DISTINCT s, a, u.capabilities AS caps CALL { WITH a OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH r order by r.displayName RETURN apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles } MATCH (s)-[:STUDY_TO_ORG]->(o:Organization{tildaid:$orgId, delpending:false}) // DISTINCT restores the dedup the old (u,o,s,a) grouping gave for free: two parallel // STUDY_TO_ORG edges would otherwise emit the study twice. The ORDER BY makes the // studies array a stable sequence for clients rather than a plan-dependent one. WITH DISTINCT s, a, caps, roles, displayRoles, o ORDER BY s.name, s.tildaid, o.tildaid RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, studyName: s.name, studySponsor: s.sponsor, studyId: s.tildaid, startDate: a.startDate, endDate: a.endDate, capabilities: caps, iSBlinded: a.isBlinded, role: roles, displayRoles: displayRoles }) AS studies } CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:STAFF_TO_ACTOR]-(si:Site{delpending:false})-[:SITE_TO_SMO]->(:Smo)-[:IS_AN_ORG]->(o:Organization{tildaid:$orgId, delpending:false}) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, si, a, r order by r.displayName WITH u, o, si, a, apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, siteId: si.tildaid, siteName: si.name, siteCity: si.city, contactPhone: si.contactPhone, contactEmail: si.contactEmail, defaultLanguage: si.defaultLanguage, role: roles, displayRoles: displayRoles }) as sites } return profile{.*, organizations: organizations, studies: studies, sites: sites}
tusker
9
108 ms
365 ms
264 ms
flat
with $protocolId as protocolId, $careplanId as careplanId, null as visitRefId, $activityRefId as activityRefId, null as pvId, null as pwId, $paId as paId, $pqnrId as pqnrId, $ptId as ptId, $hdmClassId as hdmClassId call(careplanId, protoco…
with $protocolId as protocolId, $careplanId as careplanId, null as visitRefId, $activityRefId as activityRefId, null as pvId, null as pwId, $paId as paId, $pqnrId as pqnrId, $ptId 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})-[: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]-(pt:ParticipantTable{tildaid:ptId}) 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 ((( ans1[?] > ans2[?]) ))
execsvc
179
87 ms
359 ms
293 ms
flat
MATCH (o:Organization {tildaid: $org_id})<-[:RECOMMENDATION_TO_ORGANIZATION]-(r:Recommendation) WHERE EXISTS((r)-[:RECOMMENDATION_TO_DOCUMENT]->(:Document {tildaid: $doc_id})) AND r.category = $category RETURN count(r) as total
MATCH (o:Organization {tildaid: $org_id})<-[:RECOMMENDATION_TO_ORGANIZATION]-(r:Recommendation) WHERE EXISTS((r)-[:RECOMMENDATION_TO_DOCUMENT]->(:Document {tildaid: $doc_id})) AND r.category = $category RETURN count(r) as total
virtual-assistant
87
171 ms
239 ms
275 ms
flat
MATCH (doc:Document)-[:DOC_TO_ORG]->(org:Organization) WHERE doc.stateTag = ? AND doc.aiEnabled = true AND doc.delpending = false AND doc.collection = ? AND toLower(org.alias) = toLower($orgAlias) RETURN count(doc) AS queue_size
MATCH (doc:Document)-[:DOC_TO_ORG]->(org:Organization) WHERE doc.stateTag = ? AND doc.aiEnabled = true AND doc.delpending = false AND doc.collection = ? AND toLower(org.alias) = toLower($orgAlias) RETURN count(doc) AS queue_size
studioai-production
164
119 ms
196 ms
230 ms
flat
MATCH (doc:Document)-[:DOC_TO_ORG]->(org:Organization) WHERE doc.stateTag = ? AND doc.aiEnabled = true AND doc.delpending = false AND doc.collection = ? AND toLower(org.alias) = toLower($orgAlias) RETURN count(doc) AS queue_size
MATCH (doc:Document)-[:DOC_TO_ORG]->(org:Organization) WHERE doc.stateTag = ? AND doc.aiEnabled = true AND doc.delpending = false AND doc.collection = ? AND toLower(org.alias) = toLower($orgAlias) RETURN count(doc) AS queue_size
studioai-production
81
120 ms
195 ms
178 ms
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
12
123 ms
195 ms
136 ms
flat
MATCH (doc:Document)-[:DOC_TO_ORG]->(org:Organization) WHERE doc.stateTag = ? AND doc.aiEnabled = true AND doc.delpending = false AND doc.collection = ? AND toLower(org.alias) = toLower($orgAlias) RETURN count(doc) AS queue_size
MATCH (doc:Document)-[:DOC_TO_ORG]->(org:Organization) WHERE doc.stateTag = ? AND doc.aiEnabled = true AND doc.delpending = false AND doc.collection = ? AND toLower(org.alias) = toLower($orgAlias) RETURN count(doc) AS queue_size
studioai-production
76
136 ms
195 ms
157 ms
flat
MATCH (pv:ParticipantVisit) WHERE (pv.edcStatus IS NULL OR pv.edcStatus = ? OR pv.edcStatus = ? OR pv.edcStatus = ?) AND (pv.status = ? OR pv.status = ?) AND pv.deltimestamp = ? MATCH (cp:CarePlan {tildaid: pv.carePlanId})-[:EXECUTE_SOA]- …
MATCH (pv:ParticipantVisit) WHERE (pv.edcStatus IS NULL OR pv.edcStatus = ? OR pv.edcStatus = ? OR pv.edcStatus = ?) AND (pv.status = ? OR pv.status = ?) AND pv.deltimestamp = ? MATCH (cp:CarePlan {tildaid: pv.carePlanId})-[:EXECUTE_SOA]- (soa:ScheduleOfActivities)-[:SOA_TO_PLAN_DEFINITION]- (pd:DslPlanDefinition) MATCH (pd)-[:PLAN_DEFINITION_TO_STUDY]-(st:Study) MATCH (pd)-[:PLAN_DEFINITION_TO_SITE]-(site:Site)-[:SITE_TO_SMO]- (smo)-[:IS_AN_ORG]-(org:Organization) OPTIONAL MATCH (visit:VisitV2)-[:BELONGS_TO_VISIT]-(pv) WITH pv, cp, st, site, org, visit OPTIONAL MATCH (pv)-[:PARTICIPANT_ACTIVITY]->(emptyPa:ParticipantActivity) WHERE (emptyPa.edcStatus IS NULL OR emptyPa.edcStatus = ?) AND emptyPa.deltimestamp = ? WITH pv, cp, st, site, org, visit, collect(emptyPa) AS emptyPas OPTIONAL MATCH (pv)-[:PARTICIPANT_ACTIVITY]->(pa:ParticipantActivity)-[:BELONGS_TO_ACTIVITY]->(act:ActivityV2) WHERE pa.deltimestamp = ? RETURN pv, cp, st, site, org, visit, emptyPas, collect({pa: pa, activity: act}) AS paActPairs LIMIT ?
execsvc
4
148 ms
195 ms
179 ms
flat
MATCH (pv:ParticipantVisit) WHERE (pv.edcStatus IS NULL OR pv.edcStatus = ? OR pv.edcStatus = ? OR pv.edcStatus = ?) AND (pv.status = ? OR pv.status = ?) AND pv.deltimestamp = ? MATCH (cp:CarePlan {tildaid: pv.carePlanId})-[:EXECUTE_SOA]- …
MATCH (pv:ParticipantVisit) WHERE (pv.edcStatus IS NULL OR pv.edcStatus = ? OR pv.edcStatus = ? OR pv.edcStatus = ?) AND (pv.status = ? OR pv.status = ?) AND pv.deltimestamp = ? MATCH (cp:CarePlan {tildaid: pv.carePlanId})-[:EXECUTE_SOA]- (soa:ScheduleOfActivities)-[:SOA_TO_PLAN_DEFINITION]- (pd:DslPlanDefinition) MATCH (pd)-[:PLAN_DEFINITION_TO_STUDY]-(st:Study) MATCH (pd)-[:PLAN_DEFINITION_TO_SITE]-(site:Site)-[:SITE_TO_SMO]- (smo)-[:IS_AN_ORG]-(org:Organization) OPTIONAL MATCH (visit:VisitV2)-[:BELONGS_TO_VISIT]-(pv) WITH pv, cp, st, site, org, visit OPTIONAL MATCH (pv)-[:PARTICIPANT_ACTIVITY]->(emptyPa:ParticipantActivity) WHERE (emptyPa.edcStatus IS NULL OR emptyPa.edcStatus = ?) AND emptyPa.deltimestamp = ? WITH pv, cp, st, site, org, visit, collect(emptyPa) AS emptyPas OPTIONAL MATCH (pv)-[:PARTICIPANT_ACTIVITY]->(pa:ParticipantActivity)-[:BELONGS_TO_ACTIVITY]->(act:ActivityV2) WHERE pa.deltimestamp = ? RETURN pv, cp, st, site, org, visit, emptyPas, collect({pa: pa, activity: act}) AS paActPairs LIMIT ?
execsvc
1
188 ms
195 ms
188 ms
flat
MATCH (doc:Document)-[:DOC_TO_ORG]->(org:Organization) WHERE doc.stateTag = ? AND doc.aiEnabled = true AND doc.delpending = false AND doc.collection = ? AND toLower(org.alias) = toLower($orgAlias) RETURN count(doc) AS queue_size
MATCH (doc:Document)-[:DOC_TO_ORG]->(org:Organization) WHERE doc.stateTag = ? AND doc.aiEnabled = true AND doc.delpending = false AND doc.collection = ? AND toLower(org.alias) = toLower($orgAlias) RETURN count(doc) AS queue_size
studioai-production
167
138 ms
195 ms
180 ms
flat
MATCH (o:Organization {tildaid: $org_id})<-[:RECOMMENDATION_TO_ORGANIZATION]-(r:Recommendation) WHERE EXISTS((r)-[:RECOMMENDATION_TO_DOCUMENT]->(:Document {tildaid: $doc_id})) AND r.category = $category // Get document name, site info, and…
MATCH (o:Organization {tildaid: $org_id})<-[:RECOMMENDATION_TO_ORGANIZATION]-(r:Recommendation) WHERE EXISTS((r)-[:RECOMMENDATION_TO_DOCUMENT]->(:Document {tildaid: $doc_id})) AND r.category = $category // Get document name, site info, and study info for derived properties OPTIONAL MATCH (r)-[:RECOMMENDATION_TO_DOCUMENT]->(d:Document) OPTIONAL MATCH (d)-[:INCLUDES]-(:Binder)-[:BINDER_FOR]-(s:Site) OPTIONAL MATCH (d)-[:INCLUDES]-(:Binder)-[:BINDER_FOR]-(study:Study) WITH r, d, s, study ORDER BY CASE r.category WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? ELSE ? END ASC SKIP $skip LIMIT $limit // Create virtual node with basic properties plus documentName, siteName, siteId, contentType, and location fields CALL apoc.create.vNode( [?], { tildaid: r.tildaid, rec_id: COALESCE(r.rec_id, substring(r.tildaid, ?, ?)), doc_id: r.doc_id, user_action: r.user_action, status: r.status, category: r.category, data: r.data, data_formatted: CASE WHEN r.data_formatted IS NOT NULL AND r.data_formatted <> ? THEN apoc.convert.fromJsonMap(r.data_formatted) ELSE null END, data_internal: r.data_internal, explanation: r.explanation, comment: r.comment, comment_annotated_by: r.comment_annotated_by, comment_annotated_at: r.comment_annotated_at, createdat: r.createdat, updatedat: r.updatedat, type: r.type, severity: r.severity, // Add derived properties from related nodes documentName: COALESCE(d.fileName, ?), siteName: COALESCE(s.name, null), siteId: COALESCE(s.tildaid, null), studyId: COALESCE(study.tildaid, null), studyName: COALESCE(study.name, null), contentType: COALESCE(d.contentType, null), // Add location fields for QC recommendations locationType: r.locationType, pageIndex: r.pageIndex, xCoordinate: r.xCoordinate, yCoordinate: r.yCoordinate, // Add support flag isIgnoredBySupport: COALESCE(r.isIgnoredBySupport, false) } ) YIELD node AS recommendationNode RETURN recommendationNode
writevirtual-assistant
87
169 ms
195 ms
186 ms
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
4
164 ms
195 ms
167 ms
flat
MATCH (pv:ParticipantVisit) WHERE (pv.edcStatus IS NULL OR pv.edcStatus = ? OR pv.edcStatus = ? OR pv.edcStatus = ?) AND (pv.status = ? OR pv.status = ?) AND pv.deltimestamp = ? MATCH (cp:CarePlan {tildaid: pv.carePlanId})-[:EXECUTE_SOA]- …
MATCH (pv:ParticipantVisit) WHERE (pv.edcStatus IS NULL OR pv.edcStatus = ? OR pv.edcStatus = ? OR pv.edcStatus = ?) AND (pv.status = ? OR pv.status = ?) AND pv.deltimestamp = ? MATCH (cp:CarePlan {tildaid: pv.carePlanId})-[:EXECUTE_SOA]- (soa:ScheduleOfActivities)-[:SOA_TO_PLAN_DEFINITION]- (pd:DslPlanDefinition) MATCH (pd)-[:PLAN_DEFINITION_TO_STUDY]-(st:Study) MATCH (pd)-[:PLAN_DEFINITION_TO_SITE]-(site:Site)-[:SITE_TO_SMO]- (smo)-[:IS_AN_ORG]-(org:Organization) OPTIONAL MATCH (visit:VisitV2)-[:BELONGS_TO_VISIT]-(pv) WITH pv, cp, st, site, org, visit OPTIONAL MATCH (pv)-[:PARTICIPANT_ACTIVITY]->(emptyPa:ParticipantActivity) WHERE (emptyPa.edcStatus IS NULL OR emptyPa.edcStatus = ?) AND emptyPa.deltimestamp = ? WITH pv, cp, st, site, org, visit, collect(emptyPa) AS emptyPas OPTIONAL MATCH (pv)-[:PARTICIPANT_ACTIVITY]->(pa:ParticipantActivity)-[:BELONGS_TO_ACTIVITY]->(act:ActivityV2) WHERE pa.deltimestamp = ? RETURN pv, cp, st, site, org, visit, emptyPas, collect({pa: pa, activity: act}) AS paActPairs LIMIT ?
execsvc
4
180 ms
195 ms
186 ms
flat
MATCH (study:Study )-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE NOT EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) AND EXISTS((study)-[:STUDY_TO_ORG{inherited:false}]-(:Organization{orgType:?})) CALL { WITH t MATCH (t)<-[:CREATED_FRO…
MATCH (study:Study )-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE NOT EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) AND EXISTS((study)-[:STUDY_TO_ORG{inherited:false}]-(:Organization{orgType:?})) CALL { WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantControl)-[:PARTICIPANT_CONTROL]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw UNION ALL WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw } WITH DISTINCT study, t, ptc, pw MATCH (t)-[:BELONGS_TO]-(:Inbox)-[:MANAGED_BY]-(o:Organization) MATCH (ptc)-[:BELONGS_TO_TASKCONFIG]-(tc:TaskConfig) OPTIONAL MATCH (t)-[:BELONGS_TO]-(taskInbox:Inbox{type:?})--(taskUser:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:StudySiteActor)-[:STUDYSITEACTOR_TO_ACTOR]-(:Actor{delpending:false})-[:FOR_USER]-(user:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(scopeSite:Site)-[:SITE_TO_SMO]-(:Smo)-[:IS_AN_ORG]-(o) WITH DISTINCT study, t, o, tc, taskInbox, taskUser, user, scopeSite SKIP $skip LIMIT $limit WITH collect({study:study, t:t, o:o, tc:tc, taskInbox:taskInbox, taskUser:taskUser, user:user, scopeSite:scopeSite}) AS rows, collect(DISTINCT study) AS studies, collect(DISTINCT o) AS orgs, collect(DISTINCT scopeSite) AS sites CALL { WITH studies UNWIND studies AS study OPTIONAL MATCH (study)-[:STUDY_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(r:Role) WHERE r.name IN [?, ?, ?] RETURN study.tildaid AS studyId, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS piTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS smoTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS raTildaid } WITH rows, orgs, sites, collect({studyId: studyId, pi: piTildaid, smo: smoTildaid, ra: raTildaid}) AS studyRoles CALL { WITH orgs UNWIND orgs AS o OPTIONAL MATCH (o)-[:ORGANIZATION_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN o.tildaid AS orgId, collect(DISTINCT u.tildaid) AS adminTildaid } WITH rows, sites, studyRoles, collect({orgId: orgId, admin: adminTildaid}) AS orgRoles CALL { WITH sites UNWIND (CASE WHEN size(sites) = ? THEN [null] ELSE sites END) AS scopeSite OPTIONAL MATCH (scopeSite)-[:STAFF_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN scopeSite.tildaid AS siteId, collect(DISTINCT u.tildaid) AS siteAdminTildaid } WITH rows, studyRoles, orgRoles, collect({siteId: siteId, admin: siteAdminTildaid}) AS siteRoles UNWIND rows AS row WITH row, [x IN studyRoles WHERE x.studyId = row.study.tildaid][?] AS sr, [x IN orgRoles WHERE x.orgId = row.o.tildaid][?] AS orr, [x IN siteRoles WHERE row.scopeSite IS NOT NULL AND x.siteId = row.scopeSite.tildaid][?] AS str RETURN DISTINCT row.t AS task, apoc.convert.toJson({userTildaid: row.user.tildaid, userName: row.user.name, PITildaid: sr.pi, studyOwnerTildaid: sr.smo, regAnalystTildaid: sr.ra, orgAdminTildaid: orr.admin, studyName: row.study.name, siteName: row.scopeSite.name, siteAdminTildaid: CASE WHEN row.scopeSite IS NULL THEN [] ELSE str.admin END}) AS details, row.tc.who AS dsnWho, row.o.alias AS orgAlias, row.taskInbox, row.taskUser.tildaid AS taskUserId
tusker
1
147 ms
195 ms
147 ms
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
5
129 ms
195 ms
136 ms
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
3
165 ms
195 ms
170 ms
flat
MATCH (u:User{tildaid:$userId}), (o:Organization{delpending:false, alias:$orgAlias}) call { with u, o // An Inactive actor holds no roles (ENG-?): its roles would otherwise // still feed hidePhi, the role list and every policy match. OPTIO…
MATCH (u:User{tildaid:$userId}), (o:Organization{delpending:false, alias:$orgAlias}) call { with u, o // An Inactive actor holds no roles (ENG-?): its roles would otherwise // still feed hidePhi, the role list and every policy match. OPTIONAL MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o), (a)-[:APPOINTED_AS]->(r:Role) WHERE not r.name = ? AND coalesce(a.state, ?) <> ? return r{.*} UNION with u, o // Delegated engagements in o. Only the delegated roles cross over — // the TildaScale Actor?s list. 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:$tildaScaleAlias}) WHERE st.srcorgid = o.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag IN apoc.text.split(coalesce(r.tags, ?), ?) return distinct r{.*} } WITH u, o, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles, ANY(n IN COLLECT(r.external) WHERE n = true) as external, ANY(n IN COLLECT(r.name) WHERE n = ?) as isPatient, ALL(n IN COLLECT(r.piiAccess) WHERE n = false) as hidePhi WITH u, o, {organization:o{.*}, external: external, isPatient: isPatient, hidePhi: hidePhi, roles: roles, displayRoles: displayRoles } as context CALL {WITH u, o MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:STAFF_TO_ACTOR]-(si:Site{delpending:false})-[:SITE_TO_SMO]->(:Smo)-[:IS_AN_ORG]->(o) WHERE coalesce(a.state, ?) <> ? OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, si, a, r order by r.displayName WITH u, o, si, a, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles WITH CASE when not si is null then {siteId: si.tildaid, roles: roles, displayRoles: displayRoles} end as si return collect(si) as sites, apoc.coll.flatten(collect(si.roles)) as siteRoles } CALL {WITH u, o // WITH DISTINCT is a required pipeline barrier (see the studyMembership note // in scope.go): without it (u)<-[:FOR_USER]-(a) re-expands once per study in // the org — ?.0M -> 32k db hits. Splitting the MATCH without DISTINCT does // nothing; the barrier is what forbids the bad join order. Not applied to the // sites or org-roles subqueries, where it measured neutral or worse. // No longer OPTIONAL: the subquery ends in an ungrouped aggregation, so zero // matches still yield one row with empty collections. CALL {WITH u, o MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false, orgId:o.tildaid}) WHERE coalesce(a.state, ?) <> ? WITH DISTINCT u, o, a MATCH (a)<-[:STUDY_TO_ACTOR]-(s:Study{delpending:false})-[:STUDY_TO_ORG]->(o) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) RETURN s, a, r UNION // Delegated engagement Actors: orgId is TildaScale? roles. WITH s, r order by r.displayName WITH s, collect(distinct r.name) as roles, collect(distinct case when r.listed = true then r.displayName end) as displayRoles // Ordered so the studies array is a stable sequence for clients; the pipeline // that replaced the old (u,o,s,a) grouping otherwise leaves it plan-dependent. WITH s, CASE when not s is null then {studyId: s.tildaid, name: s.name, roles: roles, displayRoles: displayRoles, srcOrgId: s.srcorgid} end as st ORDER BY s.name, s.tildaid return collect(st) as studies, apoc.coll.flatten(collect(st.roles)) as studyRoles } with distinct context, studies, apoc.coll.toSet(apoc.coll.flatten(collect(studyRoles))) as allStudyRoles, apoc.coll.toSet(apoc.coll.flatten(collect(siteRoles))) as siRoles with context, studies, apoc.coll.toSet(apoc.coll.flatten([context.roles, allStudyRoles, siRoles])) as allRoles return context{.*, studies: studies, allRoles: allRoles}
schedsvc
1
104 ms
195 ms
104 ms
flat
MERGE (a:Emr{deltimestamp:$a_deltimestamp,emrname:$a_emrname,emrversion:$a_emrversion,integrationtype:$a_integrationtype}) ON CREATE SET a.createdat = timestamp(), a.tildaid = randomUUID() ON MATCH SET a.updatedat = timestamp() SET a.holdb…
MERGE (a:Emr{deltimestamp:$a_deltimestamp,emrname:$a_emrname,emrversion:$a_emrversion,integrationtype:$a_integrationtype}) ON CREATE SET a.createdat = timestamp(), a.tildaid = randomUUID() ON MATCH SET a.updatedat = timestamp() SET a.holdbitmap=$a_holdbitmap,a.delpending=$a_delpending RETURN a.tildaid
writepatientsvc
1
178 ms
195 ms
178 ms
flat
match(phi:Phi)<-[r:HAS_PROTECTED_DATA_IN]-(p:Patient)-[:ORGANIZATION_TO_PATIENT]-(:Organization{tildaid:$phiOrgId}) with phi, p match(p)-[]-(mg:MedicalGroup) with phi, p, mg optional match(p)-[r:USER_TO_PATIENT]-(u:User) with u.tildaid as …
match(phi:Phi)<-[r:HAS_PROTECTED_DATA_IN]-(p:Patient)-[:ORGANIZATION_TO_PATIENT]-(:Organization{tildaid:$phiOrgId}) with phi, p match(p)-[]-(mg:MedicalGroup) with phi, p, mg optional match(p)-[r:USER_TO_PATIENT]-(u:User) with u.tildaid as patUserId, phi, p, mg optional match(p)-[r:INTERESTED_CONDITIONS]->(cond:AdvCampaignCondition) with patUserId, phi, p, mg, collect(cond.tildaid) as condIds with * optional match(p)-[:BINDER_FOR]-(:Binder{binderType:?, scope:?})-[:INCLUDES]-(doc:Document{docTypeName:?})-[:BELONGS_TO]-(pdo:ParticipantDocOverlay{participantReviewed:true}) with count(pdo) as pdoCount, phi, p, mg, condIds, patUserId with * optional match(adv:Advocate{orgid:$phiOrgId, userid:patUserId}) with * match(phi)-[]-(ehrPhi:EhrPhi) return phi, p, mg, ehrPhi, condIds, patUserId, pdoCount, adv order by p.lastcontacted desc limit $pgLimit
patientsvc
1
171 ms
195 ms
171 ms
flat
MATCH (o:Organization {tildaid: $org_id})<-[:RECOMMENDATION_TO_ORGANIZATION]-(r:Recommendation) WHERE EXISTS((r)-[:RECOMMENDATION_TO_DOCUMENT]->(:Document {tildaid: $doc_id})) AND r.category = $category // Get document name, site info, and…
MATCH (o:Organization {tildaid: $org_id})<-[:RECOMMENDATION_TO_ORGANIZATION]-(r:Recommendation) WHERE EXISTS((r)-[:RECOMMENDATION_TO_DOCUMENT]->(:Document {tildaid: $doc_id})) AND r.category = $category // Get document name, site info, and study info for derived properties OPTIONAL MATCH (r)-[:RECOMMENDATION_TO_DOCUMENT]->(d:Document) OPTIONAL MATCH (d)-[:INCLUDES]-(:Binder)-[:BINDER_FOR]-(s:Site) OPTIONAL MATCH (d)-[:INCLUDES]-(:Binder)-[:BINDER_FOR]-(study:Study) WITH r, d, s, study ORDER BY CASE r.category WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? WHEN ? THEN ? ELSE ? END ASC SKIP $skip LIMIT $limit // Create virtual node with basic properties plus documentName, siteName, siteId, contentType, and location fields CALL apoc.create.vNode( [?], { tildaid: r.tildaid, rec_id: COALESCE(r.rec_id, substring(r.tildaid, ?, ?)), doc_id: r.doc_id, user_action: r.user_action, status: r.status, category: r.category, data: r.data, data_formatted: CASE WHEN r.data_formatted IS NOT NULL AND r.data_formatted <> ? THEN apoc.convert.fromJsonMap(r.data_formatted) ELSE null END, data_internal: r.data_internal, explanation: r.explanation, comment: r.comment, comment_annotated_by: r.comment_annotated_by, comment_annotated_at: r.comment_annotated_at, createdat: r.createdat, updatedat: r.updatedat, type: r.type, severity: r.severity, // Add derived properties from related nodes documentName: COALESCE(d.fileName, ?), siteName: COALESCE(s.name, null), siteId: COALESCE(s.tildaid, null), studyId: COALESCE(study.tildaid, null), studyName: COALESCE(study.name, null), contentType: COALESCE(d.contentType, null), // Add location fields for QC recommendations locationType: r.locationType, pageIndex: r.pageIndex, xCoordinate: r.xCoordinate, yCoordinate: r.yCoordinate, // Add support flag isIgnoredBySupport: COALESCE(r.isIgnoredBySupport, false) } ) YIELD node AS recommendationNode RETURN recommendationNode
writevirtual-assistant
72
106 ms
195 ms
136 ms
flat
MATCH (o:Organization {tildaid: $org_id})<-[:RECOMMENDATION_TO_ORGANIZATION]-(r:Recommendation) WHERE EXISTS((r)-[:RECOMMENDATION_TO_DOCUMENT]->(:Document {tildaid: $doc_id})) AND r.category = $category RETURN count(r) as total
MATCH (o:Organization {tildaid: $org_id})<-[:RECOMMENDATION_TO_ORGANIZATION]-(r:Recommendation) WHERE EXISTS((r)-[:RECOMMENDATION_TO_DOCUMENT]->(:Document {tildaid: $doc_id})) AND r.category = $category RETURN count(r) as total
virtual-assistant
72
105 ms
194 ms
133 ms
flat
MATCH (study:Study )-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE NOT EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) AND EXISTS((study)-[:STUDY_TO_ORG{inherited:false}]-(:Organization{orgType:?})) CALL { WITH t MATCH (t)<-[:CREATED_FRO…
MATCH (study:Study )-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE NOT EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) AND EXISTS((study)-[:STUDY_TO_ORG{inherited:false}]-(:Organization{orgType:?})) CALL { WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantControl)-[:PARTICIPANT_CONTROL]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw UNION ALL WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw } WITH DISTINCT study, t, ptc, pw MATCH (t)-[:BELONGS_TO]-(:Inbox)-[:MANAGED_BY]-(o:Organization) MATCH (ptc)-[:BELONGS_TO_TASKCONFIG]-(tc:TaskConfig) OPTIONAL MATCH (t)-[:BELONGS_TO]-(taskInbox:Inbox{type:?})--(taskUser:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:StudySiteActor)-[:STUDYSITEACTOR_TO_ACTOR]-(:Actor{delpending:false})-[:FOR_USER]-(user:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(scopeSite:Site)-[:SITE_TO_SMO]-(:Smo)-[:IS_AN_ORG]-(o) WITH DISTINCT study, t, o, tc, taskInbox, taskUser, user, scopeSite SKIP $skip LIMIT $limit WITH collect({study:study, t:t, o:o, tc:tc, taskInbox:taskInbox, taskUser:taskUser, user:user, scopeSite:scopeSite}) AS rows, collect(DISTINCT study) AS studies, collect(DISTINCT o) AS orgs, collect(DISTINCT scopeSite) AS sites CALL { WITH studies UNWIND studies AS study OPTIONAL MATCH (study)-[:STUDY_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(r:Role) WHERE r.name IN [?, ?, ?] RETURN study.tildaid AS studyId, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS piTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS smoTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS raTildaid } WITH rows, orgs, sites, collect({studyId: studyId, pi: piTildaid, smo: smoTildaid, ra: raTildaid}) AS studyRoles CALL { WITH orgs UNWIND orgs AS o OPTIONAL MATCH (o)-[:ORGANIZATION_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN o.tildaid AS orgId, collect(DISTINCT u.tildaid) AS adminTildaid } WITH rows, sites, studyRoles, collect({orgId: orgId, admin: adminTildaid}) AS orgRoles CALL { WITH sites UNWIND (CASE WHEN size(sites) = ? THEN [null] ELSE sites END) AS scopeSite OPTIONAL MATCH (scopeSite)-[:STAFF_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN scopeSite.tildaid AS siteId, collect(DISTINCT u.tildaid) AS siteAdminTildaid } WITH rows, studyRoles, orgRoles, collect({siteId: siteId, admin: siteAdminTildaid}) AS siteRoles UNWIND rows AS row WITH row, [x IN studyRoles WHERE x.studyId = row.study.tildaid][?] AS sr, [x IN orgRoles WHERE x.orgId = row.o.tildaid][?] AS orr, [x IN siteRoles WHERE row.scopeSite IS NOT NULL AND x.siteId = row.scopeSite.tildaid][?] AS str RETURN DISTINCT row.t AS task, apoc.convert.toJson({userTildaid: row.user.tildaid, userName: row.user.name, PITildaid: sr.pi, studyOwnerTildaid: sr.smo, regAnalystTildaid: sr.ra, orgAdminTildaid: orr.admin, studyName: row.study.name, siteName: row.scopeSite.name, siteAdminTildaid: CASE WHEN row.scopeSite IS NULL THEN [] ELSE str.admin END}) AS details, row.tc.who AS dsnWho, row.o.alias AS orgAlias, row.taskInbox, row.taskUser.tildaid AS taskUserId
tusker
4
145 ms
193 ms
194 ms
flat
MATCH (study:Study )-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE NOT EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) AND EXISTS((study)-[:STUDY_TO_ORG{inherited:false}]-(:Organization{orgType:?})) CALL { WITH t MATCH (t)<-[:CREATED_FRO…
MATCH (study:Study )-[:MANAGED_BY]-(:Inbox)-[:BELONGS_TO]-(t:Task) WHERE NOT EXISTS ((t)-[:BELONGS_TO]-(:Inbox{type:?})) AND EXISTS((study)-[:STUDY_TO_ORG{inherited:false}]-(:Organization{orgType:?})) CALL { WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantControl)-[:PARTICIPANT_CONTROL]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw UNION ALL WITH t MATCH (t)<-[:CREATED_FROM_SPEC]-(ptc:ParticipantTaskConfig)-[:PARTICIPANT_TASKCONFIG]-(:ParticipantTaskList)-[:PARTICIPANT_TASKLIST]-(:ParticipantActivity)-[:PARTICIPANT_ACTIVITY]-(pw:ParticipantWorkflow) RETURN ptc, pw } WITH DISTINCT study, t, ptc, pw MATCH (t)-[:BELONGS_TO]-(:Inbox)-[:MANAGED_BY]-(o:Organization) MATCH (ptc)-[:BELONGS_TO_TASKCONFIG]-(tc:TaskConfig) OPTIONAL MATCH (t)-[:BELONGS_TO]-(taskInbox:Inbox{type:?})--(taskUser:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:StudySiteActor)-[:STUDYSITEACTOR_TO_ACTOR]-(:Actor{delpending:false})-[:FOR_USER]-(user:User) OPTIONAL MATCH (pw)-[:PARTICIPANTWORKFLOW_TO_SCOPE]-(:DslPlanDefinition)-[:PLAN_DEFINITION_TO_SITE]-(scopeSite:Site)-[:SITE_TO_SMO]-(:Smo)-[:IS_AN_ORG]-(o) WITH DISTINCT study, t, o, tc, taskInbox, taskUser, user, scopeSite SKIP $skip LIMIT $limit WITH collect({study:study, t:t, o:o, tc:tc, taskInbox:taskInbox, taskUser:taskUser, user:user, scopeSite:scopeSite}) AS rows, collect(DISTINCT study) AS studies, collect(DISTINCT o) AS orgs, collect(DISTINCT scopeSite) AS sites CALL { WITH studies UNWIND studies AS study OPTIONAL MATCH (study)-[:STUDY_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(r:Role) WHERE r.name IN [?, ?, ?] RETURN study.tildaid AS studyId, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS piTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS smoTildaid, collect(DISTINCT CASE WHEN r.name = ? THEN u.tildaid END) AS raTildaid } WITH rows, orgs, sites, collect({studyId: studyId, pi: piTildaid, smo: smoTildaid, ra: raTildaid}) AS studyRoles CALL { WITH orgs UNWIND orgs AS o OPTIONAL MATCH (o)-[:ORGANIZATION_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN o.tildaid AS orgId, collect(DISTINCT u.tildaid) AS adminTildaid } WITH rows, sites, studyRoles, collect({orgId: orgId, admin: adminTildaid}) AS orgRoles CALL { WITH sites UNWIND (CASE WHEN size(sites) = ? THEN [null] ELSE sites END) AS scopeSite OPTIONAL MATCH (scopeSite)-[:STAFF_TO_ACTOR]-(a:Actor{delpending:false})-[:FOR_USER]-(u:User), (a)-[:APPOINTED_AS]-(:Role{name:?}) RETURN scopeSite.tildaid AS siteId, collect(DISTINCT u.tildaid) AS siteAdminTildaid } WITH rows, studyRoles, orgRoles, collect({siteId: siteId, admin: siteAdminTildaid}) AS siteRoles UNWIND rows AS row WITH row, [x IN studyRoles WHERE x.studyId = row.study.tildaid][?] AS sr, [x IN orgRoles WHERE x.orgId = row.o.tildaid][?] AS orr, [x IN siteRoles WHERE row.scopeSite IS NOT NULL AND x.siteId = row.scopeSite.tildaid][?] AS str RETURN DISTINCT row.t AS task, apoc.convert.toJson({userTildaid: row.user.tildaid, userName: row.user.name, PITildaid: sr.pi, studyOwnerTildaid: sr.smo, regAnalystTildaid: sr.ra, orgAdminTildaid: orr.admin, studyName: row.study.name, siteName: row.scopeSite.name, siteAdminTildaid: CASE WHEN row.scopeSite IS NULL THEN [] ELSE str.admin END}) AS details, row.tc.who AS dsnWho, row.o.alias AS orgAlias, row.taskInbox, row.taskUser.tildaid AS taskUserId
tusker
6
118 ms
192 ms
189 ms
flat
match(a:Study{delpending:false,status:$status})-[r:STUDY_TO_ORG]->(b:Organization{tildaid:$orgId}) where a.tildaid in $studyScope with a optional match(a)-[scope:STUDY_TO_ACTOR]->(actor:Actor{orgId:$orgId,userId:$userId,delpending:false})-…
match(a:Study{delpending:false,status:$status})-[r:STUDY_TO_ORG]->(b:Organization{tildaid:$orgId}) where a.tildaid in $studyScope with a optional match(a)-[scope:STUDY_TO_ACTOR]->(actor:Actor{orgId:$orgId,userId:$userId,delpending:false})-[APPOINTED_AS]-(role:Role) with a, role with a, collect(role.displayName) as roles return count(a)
enrollsvc
2
50 ms
190 ms
100 ms
flat
MATCH(org:Organization{tildaid:$orgId})-[:ORGANIZATION_TO_PATIENT]-(p:Patient{tildaid:$id}) OPTIONAL MATCH (p)-[r:INTERESTED_CONDITIONS]->(cond:AdvCampaignCondition) with p, collect(cond.tildaid) as condIds OPTIONAL MATCH (p)-[:HAS_PROTECT…
MATCH(org:Organization{tildaid:$orgId})-[:ORGANIZATION_TO_PATIENT]-(p:Patient{tildaid:$id}) OPTIONAL MATCH (p)-[r:INTERESTED_CONDITIONS]->(cond:AdvCampaignCondition) with p, collect(cond.tildaid) as condIds OPTIONAL MATCH (p)-[:HAS_PROTECTED_DATA_IN]-(phi:Phi) OPTIONAL MATCH (p)<-[:RESEARCH_SUBJECT]-(cp:CarePlan)-[:EXECUTE_SOA]-(:ScheduleOfActivities)-[:SOA_TO_PLAN_DEFINITION]-(pd:DslPlanDefinition)-[:PLAN_DEFINITION_TO_STUDY]-(st:Study) OPTIONAL MATCH (pd)-[:PLAN_DEFINITION_TO_SITE]-(si:Site) WITH p, phi,condIds, cp, st, si ORDER BY st.name ASC WITH p, phi,condIds, collect({cp: cp, st: st, site:si}) AS cpStudyPairs OPTIONAL MATCH (s:Study)<-[:LEAD_TO_STUDY]-(l:Lead)-[:LEAD_TO_PATIENT]->(p) WITH p, phi,condIds, cpStudyPairs, l, s ORDER BY s.name ASC WITH p, phi,condIds, cpStudyPairs, collect({l: l, s: s}) AS lStudyPairs // Combine studyInfo and leadStudyInfo, ignoring leadStudyInfo if studyId matches WITH p, phi,condIds, cpStudyPairs, lStudyPairs, [pair IN cpStudyPairs WHERE pair.st IS NOT NULL OR pair.cp IS NOT NULL | { id: pair.st.tildaid, name: pair.st.name, sponsor: pair.st.sponsor, careplanId: pair.cp.tildaid, cpstatus: pair.cp.status, site: pair.site.name, subjectid: pair.cp.subjectid, isLocked: coalesce(pair.st.isLocked, false) } ] AS studyInfo, [pair IN lStudyPairs WHERE pair.s IS NOT NULL AND NOT pair.s.tildaid IN [cpPair IN cpStudyPairs WHERE cpPair.st IS NOT NULL | cpPair.st.tildaid] | { id: pair.s.tildaid, name: pair.s.name, sponsor: pair.s.sponsor, lstatus: pair.l.status, leadId: pair.l.tildaid, isLocked: coalesce(pair.s.isLocked, false) } ] AS leadStudyInfo WITH p, phi, condIds,studyInfo + leadStudyInfo AS combinedStudyInfo CALL apoc.create.vNode( [?], { patientId: p.tildaid, preferredLanguage: p.preferredlanguage, contactpreference: p.contactpreference, timepreference: p.timepreference, gender: p.sex, phiId: phi.tildaid, dob: phi.dob, firstname: phi.firstname, middlename: phi.middlename, lastname: phi.lastname, nickname: phi.nickname, suffix: phi.suffix, preferredname: phi.preferredname, address1: phi.address1, address2: phi.address2, city: phi.city, state: phi.state, country: phi.country, zippostalcode: phi.zippostalcode, latitude: phi.latitude, longitude: phi.longitude, email: phi.email, homephone: phi.homephone, workphone: phi.workphone, mobilephone: phi.mobilephone, primaryphonetype: phi.primaryphonetype, secondaryphonetype: phi.secondaryphonetype, emergencycontactname: phi.emergencycontactname, emergencycontactphonenumber: phi.emergencycontactphonenumber, emergencycontactrelation: phi.emergencycontactrelation, emergencycontactemail: phi.emergencycontactemail, hasStudyPartner: phi.hasstudypartner, studyPartnerName: phi.studypartnername, studyPartnerRelation: phi.studypartnerrelation, studyPartnerIsEmergencyContact: phi.studypartnerisemergencycontact, studyPartnerAddress1: phi.studypartneraddress1, studyPartnerAddress2: phi.studypartneraddress2, studyPartnerCity: phi.studypartnercity, studyPartnerState: phi.studypartnerstate, studyPartnerZipCode: phi.studypartnerzipcode, studyPartnerCountry: phi.studypartnercountry, studyPartnerEmail: phi.studypartneremail, studyPartnerPhone: phi.studypartnerphone, interestedconditionids: condIds, studyInfo: combinedStudyInfo }) YIELD node AS vNodes WITH COLLECT(vNodes) as profiles UNWIND profiles AS allprofiles RETURN allprofiles
writepatientsvc
2
94 ms
190 ms
185 ms
0.0× ↓
MATCH (u:User) WHERE u.tildaid IN $userIds AND u.status<>?OPTIONAL MATCH (u)-[:INTERNAL_DATA]-(ui:UserInternal) WITH u, COALESCE(ui.pinHash IS NOT NULL AND ui.pinHash <> ?, false) AS pinSet, COALESCE(ui.needs2Factor, false) AS needs2Factor…
MATCH (u:User) WHERE u.tildaid IN $userIds AND u.status<>?OPTIONAL MATCH (u)-[:INTERNAL_DATA]-(ui:UserInternal) WITH u, COALESCE(ui.pinHash IS NOT NULL AND ui.pinHash <> ?, false) AS pinSet, COALESCE(ui.needs2Factor, false) AS needs2Factor WITH u, u{.*, pinSet: pinSet, needs2Factor: needs2Factor} as profile CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization{tildaid:$orgId, delpending:false}) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, a, r order by r.displayName WITH u, o, a, apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, orgType: o.orgType, status: o.status, startDate: a.startDate, endDate: a.endDate, capabilities: u.capabilities, role: roles, displayRoles: displayRoles, logoDocumentId: o.logoDocumentId, theme: o.theme, logoURL: o.logoURL, pinCheckEnabled: o.pinCheckEnabled }) AS organizations } CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false,orgId:$orgId})<-[:STUDY_TO_ACTOR]-(s:Study{delpending:false}) WITH DISTINCT s, a, u.capabilities AS caps CALL { WITH a OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH r order by r.displayName RETURN apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles } MATCH (s)-[:STUDY_TO_ORG]->(o:Organization{tildaid:$orgId, delpending:false}) // DISTINCT restores the dedup the old (u,o,s,a) grouping gave for free: two parallel // STUDY_TO_ORG edges would otherwise emit the study twice. The ORDER BY makes the // studies array a stable sequence for clients rather than a plan-dependent one. WITH DISTINCT s, a, caps, roles, displayRoles, o ORDER BY s.name, s.tildaid, o.tildaid RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, studyName: s.name, studySponsor: s.sponsor, studyId: s.tildaid, startDate: a.startDate, endDate: a.endDate, capabilities: caps, iSBlinded: a.isBlinded, role: roles, displayRoles: displayRoles }) AS studies } CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:STAFF_TO_ACTOR]-(si:Site{delpending:false})-[:SITE_TO_SMO]->(:Smo)-[:IS_AN_ORG]->(o:Organization{tildaid:$orgId, delpending:false}) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, si, a, r order by r.displayName WITH u, o, si, a, apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, siteId: si.tildaid, siteName: si.name, siteCity: si.city, contactPhone: si.contactPhone, contactEmail: si.contactEmail, defaultLanguage: si.defaultLanguage, role: roles, displayRoles: displayRoles }) as sites } return profile{.*, organizations: organizations, studies: studies, sites: sites}
tusker
4
87 ms
190 ms
156 ms
flat
MATCH (u:User) WHERE u.tildaid IN $userIds AND u.status<>?OPTIONAL MATCH (u)-[:INTERNAL_DATA]-(ui:UserInternal) WITH u, COALESCE(ui.pinHash IS NOT NULL AND ui.pinHash <> ?, false) AS pinSet, COALESCE(ui.needs2Factor, false) AS needs2Factor…
MATCH (u:User) WHERE u.tildaid IN $userIds AND u.status<>?OPTIONAL MATCH (u)-[:INTERNAL_DATA]-(ui:UserInternal) WITH u, COALESCE(ui.pinHash IS NOT NULL AND ui.pinHash <> ?, false) AS pinSet, COALESCE(ui.needs2Factor, false) AS needs2Factor WITH u, u{.*, pinSet: pinSet, needs2Factor: needs2Factor} as profile CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization{tildaid:$orgId, delpending:false}) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, a, r order by r.displayName WITH u, o, a, apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, orgType: o.orgType, status: o.status, startDate: a.startDate, endDate: a.endDate, capabilities: u.capabilities, role: roles, displayRoles: displayRoles, logoDocumentId: o.logoDocumentId, theme: o.theme, logoURL: o.logoURL, pinCheckEnabled: o.pinCheckEnabled }) AS organizations } CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false,orgId:$orgId})<-[:STUDY_TO_ACTOR]-(s:Study{delpending:false}) WITH DISTINCT s, a, u.capabilities AS caps CALL { WITH a OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH r order by r.displayName RETURN apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles } MATCH (s)-[:STUDY_TO_ORG]->(o:Organization{tildaid:$orgId, delpending:false}) // DISTINCT restores the dedup the old (u,o,s,a) grouping gave for free: two parallel // STUDY_TO_ORG edges would otherwise emit the study twice. The ORDER BY makes the // studies array a stable sequence for clients rather than a plan-dependent one. WITH DISTINCT s, a, caps, roles, displayRoles, o ORDER BY s.name, s.tildaid, o.tildaid RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, studyName: s.name, studySponsor: s.sponsor, studyId: s.tildaid, startDate: a.startDate, endDate: a.endDate, capabilities: caps, iSBlinded: a.isBlinded, role: roles, displayRoles: displayRoles }) AS studies } CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:STAFF_TO_ACTOR]-(si:Site{delpending:false})-[:SITE_TO_SMO]->(:Smo)-[:IS_AN_ORG]->(o:Organization{tildaid:$orgId, delpending:false}) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, si, a, r order by r.displayName WITH u, o, si, a, apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, siteId: si.tildaid, siteName: si.name, siteCity: si.city, contactPhone: si.contactPhone, contactEmail: si.contactEmail, defaultLanguage: si.defaultLanguage, role: roles, displayRoles: displayRoles }) as sites } return profile{.*, organizations: organizations, studies: studies, sites: sites}
tusker
3
71 ms
185 ms
127 ms
flat
MATCH (u:User) WHERE u.tildaid IN $userIds AND u.status<>?OPTIONAL MATCH (u)-[:INTERNAL_DATA]-(ui:UserInternal) WITH u, COALESCE(ui.pinHash IS NOT NULL AND ui.pinHash <> ?, false) AS pinSet, COALESCE(ui.needs2Factor, false) AS needs2Factor…
MATCH (u:User) WHERE u.tildaid IN $userIds AND u.status<>?OPTIONAL MATCH (u)-[:INTERNAL_DATA]-(ui:UserInternal) WITH u, COALESCE(ui.pinHash IS NOT NULL AND ui.pinHash <> ?, false) AS pinSet, COALESCE(ui.needs2Factor, false) AS needs2Factor WITH u, u{.*, pinSet: pinSet, needs2Factor: needs2Factor} as profile CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:ORGANIZATION_TO_ACTOR]-(o:Organization{tildaid:$orgId, delpending:false}) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, a, r order by r.displayName WITH u, o, a, apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, orgType: o.orgType, status: o.status, startDate: a.startDate, endDate: a.endDate, capabilities: u.capabilities, role: roles, displayRoles: displayRoles, logoDocumentId: o.logoDocumentId, theme: o.theme, logoURL: o.logoURL, pinCheckEnabled: o.pinCheckEnabled }) AS organizations } CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false,orgId:$orgId})<-[:STUDY_TO_ACTOR]-(s:Study{delpending:false}) WITH DISTINCT s, a, u.capabilities AS caps CALL { WITH a OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH r order by r.displayName RETURN apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles } MATCH (s)-[:STUDY_TO_ORG]->(o:Organization{tildaid:$orgId, delpending:false}) // DISTINCT restores the dedup the old (u,o,s,a) grouping gave for free: two parallel // STUDY_TO_ORG edges would otherwise emit the study twice. The ORDER BY makes the // studies array a stable sequence for clients rather than a plan-dependent one. WITH DISTINCT s, a, caps, roles, displayRoles, o ORDER BY s.name, s.tildaid, o.tildaid RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, studyName: s.name, studySponsor: s.sponsor, studyId: s.tildaid, startDate: a.startDate, endDate: a.endDate, capabilities: caps, iSBlinded: a.isBlinded, role: roles, displayRoles: displayRoles }) AS studies } CALL { WITH u MATCH (u)<-[:FOR_USER]-(a:Actor{delpending:false})<-[:STAFF_TO_ACTOR]-(si:Site{delpending:false})-[:SITE_TO_SMO]->(:Smo)-[:IS_AN_ORG]->(o:Organization{tildaid:$orgId, delpending:false}) OPTIONAL MATCH (a)-[:APPOINTED_AS]->(r:Role) WITH u, o, si, a, r order by r.displayName WITH u, o, si, a, apoc.text.join(collect(distinct r.name), ?) as roles, [r IN collect(DISTINCT r) WHERE r.listed = true | r.displayName] AS displayRoles RETURN collect({ orgName: o.name, orgAlias: o.alias, orgId: o.tildaid, siteId: si.tildaid, siteName: si.name, siteCity: si.city, contactPhone: si.contactPhone, contactEmail: si.contactEmail, defaultLanguage: si.defaultLanguage, role: roles, displayRoles: displayRoles }) as sites } return profile{.*, organizations: organizations, studies: studies, sites: sites}
tusker
8
78 ms
180 ms
173 ms
flat
MATCH (currentUser:User{deltimestamp:?,deltimestamp:?,email:$email}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true) OPTIONAL MATCH (supportUser:User{email:$supportUserEmail}) OPTIONAL MATCH (targetOrg:Organization{delpe…
MATCH (currentUser:User{deltimestamp:?,deltimestamp:?,email:$email}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true) OPTIONAL MATCH (supportUser:User{email:$supportUserEmail}) OPTIONAL MATCH (targetOrg:Organization{delpending:false, alias:$orgAlias}) // A deactivated (Inactive) org actor is not a membership (ENG-?). 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 // Evaluated only for non-members; members are decided by orgActor alone. 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:$tildaScaleAlias}) WHERE st.srcorgid = targetOrg.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag 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
dashql
24
78 ms
180 ms
130 ms
flat
MATCH (currentUser:User{deltimestamp:?,deltimestamp:?,subject:$subject}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true) OPTIONAL MATCH (supportUser:User{email:$supportUserEmail}) OPTIONAL MATCH (targetOrg:Organization{d…
MATCH (currentUser:User{deltimestamp:?,deltimestamp:?,subject:$subject}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true) OPTIONAL MATCH (supportUser:User{email:$supportUserEmail}) OPTIONAL MATCH (targetOrg:Organization{delpending:false, alias:$orgAlias}) // A deactivated (Inactive) org actor is not a membership (ENG-?). 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 // Evaluated only for non-members; members are decided by orgActor alone. 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:$tildaScaleAlias}) WHERE st.srcorgid = targetOrg.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag 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
dashql
85
63 ms
175 ms
129 ms
0.5× ↓
MATCH (a:WorkOrderActivity {tildaid: $id}) WHERE a.activity_type <> ? OPTIONAL MATCH (wo:WorkOrder)-[:WORK_ORDER_TO_ACTIVITY]->(a) WITH a, head(collect(wo)) AS wo OPTIONAL MATCH (wo)-[:WORK_ORDER_TO_ORGANIZATION]->(org:Organization) OPTION…
MATCH (a:WorkOrderActivity {tildaid: $id}) WHERE a.activity_type <> ? OPTIONAL MATCH (wo:WorkOrder)-[:WORK_ORDER_TO_ACTIVITY]->(a) WITH a, head(collect(wo)) AS wo OPTIONAL MATCH (wo)-[:WORK_ORDER_TO_ORGANIZATION]->(org:Organization) OPTIONAL MATCH (wo)-[:WORK_ORDER_TO_STUDY]->(study:Study) OPTIONAL MATCH (wo)-[:WORK_ORDER_TO_SITE]->(site:Site) // Template lineage of the parent WO (parent_id -> WorkOrderConfig -> WorkOrderTemplate), denormalized. OPTIONAL MATCH (:WorkOrderConfig {tildaid: wo.parent_id})-[:WORK_ORDER_CONFIG_TO_TEMPLATE]->(tmpl:WorkOrderTemplate) CALL apoc.create.vNode([?], { tildaid: a.tildaid, workOrderActivityId: a.tildaid, workOrderId: a.work_order_id, userId: a.user_id, activityType: a.activity_type, status: a.status, source: a.source, content: a.content, original_content: a.original_content, reasoning: a.reasoning, content_type: a.content_type, body_plain: a.body_plain, body_html: a.body_html, stripped_text: a.stripped_text, stripped_html: a.stripped_html, extra_text: a.extra_text, extra_html: a.extra_html, message_id: a.message_id, sender: a.sender, from_ai_teammate_email: a.from_ai_teammate_email, from_ai_teammate_name: a.from_ai_teammate_name, attachmentInfo: a.attachmentInfo, ignoreType: a.ignoreType, auto_send_enabled: a.auto_send_enabled, documents_pending: a.documents_pending, processing_status: a.processing_status, retry_count: a.retry_count, last_attempt_at: a.last_attempt_at, openai_response_id: a.openai_response_id, errors: a.errors, questions: a.questions, answers: a.answers, answered_at: a.answered_at, agent_run_completed_at: a.agent_run_completed_at, timestamp: a.timestamp, createdat: a.createdat, updatedat: a.updatedat, // Parent work order context: immutable created timestamp (epoch millis) + business id, denormalized // so time-to-response style metrics can be computed from the activities table alone. workOrderCreatedAt: wo.createdat, workOrderBusinessId: wo.work_order_id, workOrderName: wo.title, templateId: tmpl.tildaid, templateName: tmpl.title, docIds: a.docIds, processedDocIds: a.processedDocIds, activity_contact_list: a.activity_contact_list, activity_cc_list: a.activity_cc_list, delpending: a.delpending, deltimestamp: a.deltimestamp, holdbitmap: a.holdbitmap, orgId: coalesce(org.tildaid, wo.org_id), orgName: org.name, orgAlias: org.alias, studyId: coalesce(study.tildaid, wo.study_id), studyName: study.name, siteId: coalesce(site.tildaid, wo.site_id), siteName: site.name } ) YIELD node RETURN node
writedashrsvc
10
15 ms
150 ms
134 ms
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
20
23 ms
150 ms
193 ms
flat
match (s:Study{tildaid:$studyId})-[:PLAN_DEFINITION_TO_STUDY]-(pd:DslPlanDefinition)-[:PLAN_DEFINITION_TO_CRO|:PLAN_DEFINITION_TO_SMO]-()-[:IS_AN_ORG]-(o:Organization{alias:$orgAlias}) match (s)-[:PLAN_DEFINITION_TO_STUDY]-(sitePd:DslPlanD…
match (s:Study{tildaid:$studyId})-[:PLAN_DEFINITION_TO_STUDY]-(pd:DslPlanDefinition)-[:PLAN_DEFINITION_TO_CRO|:PLAN_DEFINITION_TO_SMO]-()-[:IS_AN_ORG]-(o:Organization{alias:$orgAlias}) match (s)-[:PLAN_DEFINITION_TO_STUDY]-(sitePd:DslPlanDefinition{type:?, scopeId:$siteId}) match (sitePd)-[:PLAN_DEFINITION_TO_ADOPTED_WORKFLOWS]-(wf:WorkflowV2)-[:TRIGGER_TO_WORKFLOW]-(tr:Trigger) where tr.operation = $operation and tr.scope = $scope return distinct wf
regsvc
10
12 ms
150 ms
101 ms
flat
match(:User{email:$staffEmail})-[]-(:Staff)-[:W2026_46 | W2026_47]-(r:ResourceAppointment) where (isEmpty(r.type) or r.type=?) optional match (r)-[:RESOURCE_APPOINTMENTS]-(v:VisitAppointment)-[:VISIT_APPOINTMENT_TO_CARE_PLAN]-(:CarePlan)-[…
match(:User{email:$staffEmail})-[]-(:Staff)-[:W2026_46 | W2026_47]-(r:ResourceAppointment) where (isEmpty(r.type) or r.type=?) optional match (r)-[:RESOURCE_APPOINTMENTS]-(v:VisitAppointment)-[:VISIT_APPOINTMENT_TO_CARE_PLAN]-(:CarePlan)-[:RESEARCH_SUBJECT]-(:Patient)-[:HAS_PROTECTED_DATA_IN]-(p:Phi) optional match (v)-[]-(s:Site)-[:SITE_TO_SMO]->(smo:Smo)-[:IS_AN_ORG]->(o:Organization{alias:$orgAlias}) optional match (v)-[:VISIT_APPOINTMENT_TO_CONFERENCE_DATA]-(c:ConferenceData) return r,p,c,v,s.tildaid
schedsvc
19
27 ms
105 ms
134 ms
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
846
54 ms
98 ms
196 ms
flat
with $branchLevel as branchLevel match (ppObj:ParticipantQuestion)-[:PARTICIPANT_BRANCH]-(ppB:ParticipantBranch)-[:PARTICIPANT_CONDITION]- (pc:ParticipantCondition)-[:BELONGS_TO_CONDITION]-(c:Condition) where pc.tildaid in $pcnIds match (p…
with $branchLevel as branchLevel match (ppObj:ParticipantQuestion)-[:PARTICIPANT_BRANCH]-(ppB:ParticipantBranch)-[:PARTICIPANT_CONDITION]- (pc:ParticipantCondition)-[:BELONGS_TO_CONDITION]-(c:Condition) where pc.tildaid in $pcnIds match (ppB)-[:BELONGS_TO_BRANCH]-(pBranch:Branch) match (ppObj)-[:BELONGS_TO_QUESTION]-(pObj:Question) optional match (c)-[:OBJ_TO_QUESTION*?..{scopeId:c.nodeId,path: case when pc.value then ? else ? end}]->(childObj:Question) optional match (childObj)-[:BELONGS_TO_QUESTION]-(pChildObj:ParticipantQuestion)-[:PARTICIPANT_QUESTION]-(pqnr:ParticipantQuestionnaire{tildaid:?}) optional match (qnc:Condition)-[:BELONGS_TO_CONDITION]-(qnpc:ParticipantCondition)-[:PARTICIPANT_CONDITION]-(:ParticipantBranch)-[:PARTICIPANT_BRANCH]-(pChildObj) optional match (pChildObj)-[:BELONGS_TO]-(doc:Document{archived:false}) optional match (doc)-[:INCLUDES]-(bdr: Binder{binderType:?}) optional match (docType:DocTypeDetails{name:doc.docTypeName}) optional match (doc)-[:TAIL_CHANGELOG]-(docCL:ChangeLog) call{ with docType with docType return case when docType is not null then {typeId: docType.tildaid, typename:docType.name, typekind:docType.kind,typescope: docType.scope, typemandatoryFields: docType.mandatoryFields} else null end as opDocType } call{ with pChildObj with pChildObj optional match (pChildObj)-[:HAS_QUERY]-(q:Query) where q.delpending=false AND q.state <> ? optional match (q)-[:RAISED_BY]-(u:User) optional match (q)-[:ALL_CHANGELOG]-(qCL:ChangeLog{type:?}) with count(qCL) as commentCount,q,u return collect({query:q,user:u,commentCount:commentCount}) as queries } call{ with pChildObj with pChildObj optional match (pChildObj)-[:HAS_FLAG]-(flag:EligibilityFlag)-[:RAISED_BY]-(raisedBy:User) return collect({flag:flag,user:raisedBy}) as flags } call{ with pChildObj with pChildObj optional match (pChildObj)-[:ALL_CHANGELOG]-(qnCL:ChangeLog) where qnCL.type in [?] optional match (e:ESignature{tildaid:qnCL.blob}) with e, qnCL order by qnCL.createdat DESC return collect({eSign:e,signedBy:qnCL.Who,signedAt:qnCL.CreatedAt}) as eSignatures, collect(qnCL) as qnChangeLogs } optional match (childObj)-[:OBJ_TO_SPECNODE*?..{scopeId:childObj.nodeId}]->(sn:SpecNode) optional match (pChildObj)-[:PARTICIPANT_SPECNODE]-(psn:ParticipantSpecNode)-[:BELONGS_TO_SPECNODE]-(sn) where psn.deltimestamp=? call{ with psn with psn optional match (psn)-[:ALL_CHANGELOG]-(snCL:ChangeLog) where snCL.type in [?,?] with snCL order by snCL.createdat DESC return collect(snCL) as snChangeLogs } optional match (snc:Condition)-[:BELONGS_TO_CONDITION]-(snpc:ParticipantCondition)-[:PARTICIPANT_CONDITION]-(pb:ParticipantBranch)-[:PARTICIPANT_BRANCH]-(psn) with collect(case when doc is not null then {id:doc.tildaid, docType: opDocType, docKind: doc.docKind, versionNumber: doc.versionNumber, tag: bdr.tag,fileName:doc.fileName,uploadedBy:docCL.who,uploadedAt:docCL.createdat,size:doc.size,status:doc.status,pages:doc.pages} else null end) as opDocuments, queries,flags,eSignatures,childObj,pChildObj,qnChangeLogs,qnc,qnpc,branchLevel,pc,pObj,sn,psn,snc,snpc,snChangeLogs with collect({condition:snc,pCondition:snpc}) as sncList,childObj,pChildObj,branchLevel,pObj,pc,qnc,qnpc,queries,flags,opDocuments,eSignatures,qnChangeLogs,sn,psn,snChangeLogs with collect({specNode:sn,pSpecNode:psn,sncList:sncList,changeLogs:snChangeLogs}) as snList,childObj,pChildObj,branchLevel,pObj,pc,qnc,qnpc,queries,flags,opDocuments,eSignatures,qnChangeLogs with collect({condition:qnc,pCondition:qnpc}) as qncList,childObj,pChildObj,branchLevel,pObj,pc,queries,qnChangeLogs,flags,opDocuments,eSignatures,snList return collect({question:case when childObj is not null then apoc.create.vNode(labels(childObj), childObj{.*,branchLevel:case when pChildObj.branchLevel is not null then pChildObj.branchLevel else branchLevel end,pre:pObj.nodeId}) else null end,pQuestion:pChildObj,qncList:qncList,pParentChildId:pc.tildaid,pParentChildStatus:pc.status,snList:snList,queries:queries,changeLogs:qnChangeLogs,flags:flags,opDocuments:opDocuments,eSignatures:eSignatures})
writeexecsvc
713
53 ms
98 ms
563 ms
flat
MATCH (w:WorkOrder {source_type:?}) WHERE w.status IN [?,?,?,?] OPTIONAL MATCH (w)<-[:FACT_TO_WORK_ORDER]-(f:Fact {key:?, delpending:false}) RETURN w.status AS st, f.value AS v
MATCH (w:WorkOrder {source_type:?}) WHERE w.status IN [?,?,?,?] OPTIONAL MATCH (w)<-[:FACT_TO_WORK_ORDER]-(f:Fact {key:?, delpending:false}) RETURN w.status AS st, f.value AS v
(internal)
1
51 ms
98 ms
51 ms
flat
MATCH (w:WorkOrder {source_type:?}) WHERE w.status IN [?,?,?,?] OPTIONAL MATCH (pa:ParticipantActivity {tildaid:w.source_id}) RETURN count(w) AS open, sum(CASE WHEN pa.dueDate IS NULL OR pa.dueDate=? THEN ? ELSE ? END) AS no_due, sum(CASE …
MATCH (w:WorkOrder {source_type:?}) WHERE w.status IN [?,?,?,?] OPTIONAL MATCH (pa:ParticipantActivity {tildaid:w.source_id}) RETURN count(w) AS open, sum(CASE WHEN pa.dueDate IS NULL OR pa.dueDate=? THEN ? ELSE ? END) AS no_due, sum(CASE WHEN pa.dueDate > ? AND pa.dueDate <= $now THEN ? ELSE ? END) AS past_due
(internal)
1
53 ms
98 ms
53 ms
flat
match (task:Task) where task.tildaid in $lists.taskIds with distinct task as t call apoc.do.case([ t.relationshipContext = ?, ?, t.relationshipContext = ?, ?, t.relationshipContext = ?, ?, t.relationshipContext = ?, ?, t.relationshipContex…
match (task:Task) where task.tildaid in $lists.taskIds with distinct task as t call apoc.do.case([ t.relationshipContext = ?, ?, t.relationshipContext = ?, ?, t.relationshipContext = ?, ?, t.relationshipContext = ?, ?, t.relationshipContex…
MATCH (currentUser:User{deltimestamp:?,deltimestamp:?,subject:$subject}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true) OPTIONAL MATCH (supportUser:User{email:$supportUserEmail}) OPTIONAL MATCH (targetOrg:Organization{d…
MATCH (currentUser:User{deltimestamp:?,deltimestamp:?,subject:$subject}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true) OPTIONAL MATCH (supportUser:User{email:$supportUserEmail}) OPTIONAL MATCH (targetOrg:Organization{delpending:false, alias:$orgAlias}) // A deactivated (Inactive) org actor is not a membership (ENG-?). 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 // Evaluated only for non-members; members are decided by orgActor alone. 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:$tildaScaleAlias}) WHERE st.srcorgid = targetOrg.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag 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
onboardingsvc
2
64 ms
98 ms
69 ms
flat
match(org:Organization{tildaid:$orgId})-[:ORGANIZATION_TO_FORM]->(form:FormV2{type:$formType}) where (true) and (form.activityType is null or not form.activityType in $excludeActivityTypes) and not coalesce(form.tag, ?) in $systemFormTags …
match(org:Organization{tildaid:$orgId})-[:ORGANIZATION_TO_FORM]->(form:FormV2{type:$formType}) where (true) and (form.activityType is null or not form.activityType in $excludeActivityTypes) and not coalesce(form.tag, ?) in $systemFormTags and not form.state=? with org, count(form) as allCount optional match(org)-[:ORGANIZATION_TO_FORM]->(form:FormV2{type:$formType, state:?}) with org, allCount, count(form) as publishedCount optional match(org)-[:ORGANIZATION_TO_FORM]->(form:FormV2{type:$formType, state:?}) with org, allCount, publishedCount, count(form) as draftCount optional match(org)-[:ORGANIZATION_TO_FORM]->(form:FormV2{type:$formType, state:?}) return allCount, publishedCount, draftCount, count(form) as archivedCount
studiosvc
1
58 ms
98 ms
58 ms
flat
MATCH (p:Policy)-[:IS_ASSIGNED_TO]->(r:Role) WHERE coalesce(p.state, ?) IN [?, ?] OPTIONAL MATCH (r)<-[:MIMICS]-(m:Role) OPTIONAL MATCH (p)-[:APPLICABLE_IN]->(s:Scope {version:$scopeVersion}) UNWIND [r.name, m.name] as roleName WITH p, s, …
MATCH (p:Policy)-[:IS_ASSIGNED_TO]->(r:Role) WHERE coalesce(p.state, ?) IN [?, ?] OPTIONAL MATCH (r)<-[:MIMICS]-(m:Role) OPTIONAL MATCH (p)-[:APPLICABLE_IN]->(s:Scope {version:$scopeVersion}) UNWIND [r.name, m.name] as roleName WITH p, s, apoc.text.join(collect(DISTINCT roleName), ?) as roleList RETURN { name: p.name, roleList: roleList, objectTypeList: p.objectTypeList, allowedOps: p.allowedOps, scope: s.name } as policy
exportsvc
1
73 ms
98 ms
73 ms
flat
MATCH (p:Policy)-[:IS_ASSIGNED_TO]->(r:Role) WHERE coalesce(p.state, ?) IN [?, ?] OPTIONAL MATCH (r)<-[:MIMICS]-(m:Role) OPTIONAL MATCH (p)-[:APPLICABLE_IN]->(s:Scope {version:$scopeVersion}) UNWIND [r.name, m.name] as roleName WITH p, s, …
MATCH (p:Policy)-[:IS_ASSIGNED_TO]->(r:Role) WHERE coalesce(p.state, ?) IN [?, ?] OPTIONAL MATCH (r)<-[:MIMICS]-(m:Role) OPTIONAL MATCH (p)-[:APPLICABLE_IN]->(s:Scope {version:$scopeVersion}) UNWIND [r.name, m.name] as roleName WITH p, s, apoc.text.join(collect(DISTINCT roleName), ?) as roleList RETURN { name: p.name, roleList: roleList, objectTypeList: p.objectTypeList, allowedOps: p.allowedOps, scope: s.name } as policy
ontologysvc
1
57 ms
98 ms
57 ms
flat
match(lead:Lead) where not (lead)-[]-(:Task) with lead match(lead)-[]-(study:Study) return lead, study
match(lead:Lead) where not (lead)-[]-(:Task) with lead match(lead)-[]-(study:Study) return lead, study
patientsvc
1
57 ms
98 ms
57 ms
flat
MERGE (a:MedicalGroup{deltimestamp:$a_deltimestamp,emrname:$a_emrname,emrversion:$a_emrversion,integrationtype:$a_integrationtype,practicename:$a_practicename}) ON CREATE SET a.createdat = timestamp(), a.tildaid = randomUUID() ON MATCH SET…
MERGE (a:MedicalGroup{deltimestamp:$a_deltimestamp,emrname:$a_emrname,emrversion:$a_emrversion,integrationtype:$a_integrationtype,practicename:$a_practicename}) ON CREATE SET a.createdat = timestamp(), a.tildaid = randomUUID() ON MATCH SET a.updatedat = timestamp() SET a.practiceaddress=$a_practiceaddress,a.practicecity=$a_practicecity,a.practicecountry=$a_practicecountry,a.holdbitmap=$a_holdbitmap,a.delpending=$a_delpending,a.practicestate=$a_practicestate,a.isDeleted=$a_isDeleted RETURN a.tildaid
writepatientsvc
1
62 ms
98 ms
62 ms
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
391
52 ms
97 ms
80 ms
flat
UNWIND $orgAliases AS alias MATCH (org:Organization {alias: alias, deltimestamp: ?}) -[:ORGANIZATION_TO_ACTOR]->(a:Actor)-[:FOR_USER]->(user:User) WHERE user.status = $active MATCH (i:Inbox)-[:OWNED_BY]->(user) OPTIONAL MATCH (user)-[:USER…
UNWIND $orgAliases AS alias MATCH (org:Organization {alias: alias, deltimestamp: ?}) -[:ORGANIZATION_TO_ACTOR]->(a:Actor)-[:FOR_USER]->(user:User) WHERE user.status = $active MATCH (i:Inbox)-[:OWNED_BY]->(user) OPTIONAL MATCH (user)-[:USER_TO_PATIENT]-(patient:Patient) WITH DISTINCT i, patient OPTIONAL MATCH (task:Task)-[:BELONGS_TO]->(i) RETURN count(task), i, patient.tildaid
tusker
3
50 ms
96 ms
59 ms
flat
with $branchLevel as branchLevel match (ppObj:ParticipantQuestion)-[:PARTICIPANT_BRANCH]-(ppB:ParticipantBranch)-[:PARTICIPANT_CONDITION]- (pc:ParticipantCondition)-[:BELONGS_TO_CONDITION]-(c:Condition) where pc.tildaid in $pcnIds match (p…
with $branchLevel as branchLevel match (ppObj:ParticipantQuestion)-[:PARTICIPANT_BRANCH]-(ppB:ParticipantBranch)-[:PARTICIPANT_CONDITION]- (pc:ParticipantCondition)-[:BELONGS_TO_CONDITION]-(c:Condition) where pc.tildaid in $pcnIds match (ppB)-[:BELONGS_TO_BRANCH]-(pBranch:Branch) match (ppObj)-[:BELONGS_TO_QUESTION]-(pObj:Question) optional match (c)-[:OBJ_TO_QUESTION*?..{scopeId:c.nodeId,path: case when pc.value then ? else ? end}]->(childObj:Question) optional match (childObj)-[:BELONGS_TO_QUESTION]-(pChildObj:ParticipantQuestion)-[:PARTICIPANT_QUESTION]-(pqnr:ParticipantQuestionnaire{tildaid:?}) optional match (qnc:Condition)-[:BELONGS_TO_CONDITION]-(qnpc:ParticipantCondition)-[:PARTICIPANT_CONDITION]-(:ParticipantBranch)-[:PARTICIPANT_BRANCH]-(pChildObj) optional match (pChildObj)-[:BELONGS_TO]-(doc:Document{archived:false}) optional match (doc)-[:INCLUDES]-(bdr: Binder{binderType:?}) optional match (docType:DocTypeDetails{name:doc.docTypeName}) optional match (doc)-[:TAIL_CHANGELOG]-(docCL:ChangeLog) call{ with docType with docType return case when docType is not null then {typeId: docType.tildaid, typename:docType.name, typekind:docType.kind,typescope: docType.scope, typemandatoryFields: docType.mandatoryFields} else null end as opDocType } call{ with pChildObj with pChildObj optional match (pChildObj)-[:HAS_QUERY]-(q:Query) where q.delpending=false AND q.state <> ? optional match (q)-[:RAISED_BY]-(u:User) optional match (q)-[:ALL_CHANGELOG]-(qCL:ChangeLog{type:?}) with count(qCL) as commentCount,q,u return collect({query:q,user:u,commentCount:commentCount}) as queries } call{ with pChildObj with pChildObj optional match (pChildObj)-[:HAS_FLAG]-(flag:EligibilityFlag)-[:RAISED_BY]-(raisedBy:User) return collect({flag:flag,user:raisedBy}) as flags } call{ with pChildObj with pChildObj optional match (pChildObj)-[:ALL_CHANGELOG]-(qnCL:ChangeLog) where qnCL.type in [?] optional match (e:ESignature{tildaid:qnCL.blob}) with e, qnCL order by qnCL.createdat DESC return collect({eSign:e,signedBy:qnCL.Who,signedAt:qnCL.CreatedAt}) as eSignatures, collect(qnCL) as qnChangeLogs } optional match (childObj)-[:OBJ_TO_SPECNODE*?..{scopeId:childObj.nodeId}]->(sn:SpecNode) optional match (pChildObj)-[:PARTICIPANT_SPECNODE]-(psn:ParticipantSpecNode)-[:BELONGS_TO_SPECNODE]-(sn) where psn.deltimestamp=? call{ with psn with psn optional match (psn)-[:ALL_CHANGELOG]-(snCL:ChangeLog) where snCL.type in [?,?] with snCL order by snCL.createdat DESC return collect(snCL) as snChangeLogs } optional match (snc:Condition)-[:BELONGS_TO_CONDITION]-(snpc:ParticipantCondition)-[:PARTICIPANT_CONDITION]-(pb:ParticipantBranch)-[:PARTICIPANT_BRANCH]-(psn) with collect(case when doc is not null then {id:doc.tildaid, docType: opDocType, docKind: doc.docKind, versionNumber: doc.versionNumber, tag: bdr.tag,fileName:doc.fileName,uploadedBy:docCL.who,uploadedAt:docCL.createdat,size:doc.size,status:doc.status,pages:doc.pages} else null end) as opDocuments, queries,flags,eSignatures,childObj,pChildObj,qnChangeLogs,qnc,qnpc,branchLevel,pc,pObj,sn,psn,snc,snpc,snChangeLogs with collect({condition:snc,pCondition:snpc}) as sncList,childObj,pChildObj,branchLevel,pObj,pc,qnc,qnpc,queries,flags,opDocuments,eSignatures,qnChangeLogs,sn,psn,snChangeLogs with collect({specNode:sn,pSpecNode:psn,sncList:sncList,changeLogs:snChangeLogs}) as snList,childObj,pChildObj,branchLevel,pObj,pc,qnc,qnpc,queries,flags,opDocuments,eSignatures,qnChangeLogs with collect({condition:qnc,pCondition:qnpc}) as qncList,childObj,pChildObj,branchLevel,pObj,pc,queries,qnChangeLogs,flags,opDocuments,eSignatures,snList return collect({question:case when childObj is not null then apoc.create.vNode(labels(childObj), childObj{.*,branchLevel:case when pChildObj.branchLevel is not null then pChildObj.branchLevel else branchLevel end,pre:pObj.nodeId}) else null end,pQuestion:pChildObj,qncList:qncList,pParentChildId:pc.tildaid,pParentChildStatus:pc.status,snList:snList,queries:queries,changeLogs:qnChangeLogs,flags:flags,opDocuments:opDocuments,eSignatures:eSignatures})
writeexecsvc
651
37 ms
96 ms
497 ms
flat
MATCH (currentUser:User{deltimestamp:?,deltimestamp:?,subject:$subject}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true) OPTIONAL MATCH (supportUser:User{email:$supportUserEmail}) OPTIONAL MATCH (targetOrg:Organization{d…
MATCH (currentUser:User{deltimestamp:?,deltimestamp:?,subject:$subject}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true) OPTIONAL MATCH (supportUser:User{email:$supportUserEmail}) OPTIONAL MATCH (targetOrg:Organization{delpending:false, alias:$orgAlias}) // A deactivated (Inactive) org actor is not a membership (ENG-?). 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 // Evaluated only for non-members; members are decided by orgActor alone. 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:$tildaScaleAlias}) WHERE st.srcorgid = targetOrg.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag 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
studiosvc
74
50 ms
95 ms
85 ms
flat
match(a:Study{delpending:false,status:$status})-[r:STUDY_TO_ORG]->(b:Organization{tildaid:$orgId}) where a.tildaid in $studyScope with a optional match(a)-[scope:STUDY_TO_ACTOR]->(actor:Actor{orgId:$orgId,userId:$userId,delpending:false})-…
match(a:Study{delpending:false,status:$status})-[r:STUDY_TO_ORG]->(b:Organization{tildaid:$orgId}) where a.tildaid in $studyScope with a optional match(a)-[scope:STUDY_TO_ACTOR]->(actor:Actor{orgId:$orgId,userId:$userId,delpending:false})-[APPOINTED_AS]-(role:Role) with a, role return a, collect(role.displayName) as roles, COUNT { (a)-[:PLAN_DEFINITION_TO_STUDY]-(:DslPlanDefinition{type:?,delpending:false}) } as siteCount skip $sbSkip limit $sbLimit
enrollsvc
2
42 ms
95 ms
82 ms
flat
UNWIND $orgAliases AS alias MATCH (org:Organization {alias: alias, deltimestamp: ?}) -[:ORGANIZATION_TO_ACTOR]->(a:Actor)-[:FOR_USER]->(user:User) WHERE user.status = $active MATCH (i:Inbox)-[:OWNED_BY]->(user) OPTIONAL MATCH (user)-[:USER…
UNWIND $orgAliases AS alias MATCH (org:Organization {alias: alias, deltimestamp: ?}) -[:ORGANIZATION_TO_ACTOR]->(a:Actor)-[:FOR_USER]->(user:User) WHERE user.status = $active MATCH (i:Inbox)-[:OWNED_BY]->(user) OPTIONAL MATCH (user)-[:USER_TO_PATIENT]-(patient:Patient) WITH DISTINCT i, patient OPTIONAL MATCH (task:Task)-[:BELONGS_TO]->(i) RETURN count(task), i, patient.tildaid
tusker
2
47 ms
95 ms
50 ms
flat
MATCH (currentUser:User{deltimestamp:?,deltimestamp:?,subject:$subject}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true) OPTIONAL MATCH (supportUser:User{email:$supportUserEmail}) OPTIONAL MATCH (targetOrg:Organization{d…
MATCH (currentUser:User{deltimestamp:?,deltimestamp:?,subject:$subject}) WHERE (currentUser.isDummy IS NULL OR currentUser.isDummy <> true) OPTIONAL MATCH (supportUser:User{email:$supportUserEmail}) OPTIONAL MATCH (targetOrg:Organization{delpending:false, alias:$orgAlias}) // A deactivated (Inactive) org actor is not a membership (ENG-?). 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 // Evaluated only for non-members; members are decided by orgActor alone. 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:$tildaScaleAlias}) WHERE st.srcorgid = targetOrg.tildaid AND da.state <> ? AND sa.state <> ? AND $orgDelegatedTag 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
patientsvc
2
42 ms
95 ms
50 ms
flat
p95 drift compares the query's p95 in the recent half of the window to the earlier half — ≥1.2×
means it's slowing down. Click a row for its p50/p95 latency trend over time. Latency percentiles come from
per-bucket histograms (no individual queries stored).