There is difference between what's documented in the CRC Design Document (p 42) and the actual DB constraints.
According to this document, the PK includes:
Encounter number
Patient number
Concept code
Start date
Modifier code
Observer code
However, in reality[1], it consists of:
ENCOUNTER_NUM,
CONCEPT_CD,
PROVIDER_ID,
START_DATE,
MODIFIER_CD,
INSTANCE_NUM
I think it would make sense to at least add the patient_num to the pk. This could be necessary when the encounter and provider are unknown and point to a default row in the dimension tables. I don't have a strong preference on how to deal with the remaining differences.
[1]:
NewInstall/Crcdata/scripts/crc_create_datamart_oracle.sql:140: CONSTRAINT OBSERVATION_FACT_PK PRIMARY KEY(ENCOUNTER_NUM,CONCEPT_CD,PROVIDER_ID,START_DATE,MODIFIER_CD,INSTANCE_NUM)
NewInstall/Crcdata/scripts/crc_create_datamart_sqlserver.sql:138: CONSTRAINT OBSERVATION_FACT_PK PRIMARY KEY nonclustered (ENCOUNTER_NUM, CONCEPT_CD, PROVIDER_ID, START_DATE, MODIFIER_CD, INSTANCE_NUM)
Upgrade/Crcdata/scripts/crc_create_datamart_oracle.sql:21:drop CONSTRAINT OBSERVATION_FACT_PK
Upgrade/Crcdata/scripts/crc_create_datamart_oracle.sql:29:add CONSTRAINT OBSERVATION_FACT_PK PRIMARY KEY (ENCOUNTER_NUM,CONCEPT_CD,PROVIDER_ID,START_DATE,MODIFIER_CD,INSTANCE_NUM)
Upgrade/Crcdata/scripts/crc_create_datamart_sqlserver.sql:41:drop CONSTRAINT OBSERVATION_FACT_PK
Upgrade/Crcdata/scripts/crc_create_datamart_sqlserver.sql:82:add CONSTRAINT OBSERVATION_FACT_PK PRIMARY KEY (ENCOUNTER_NUM,CONCEPT_CD,PROVIDER_ID,START_DATE,MODIFIER_CD,INSTANCE_NUM)
{"report":{"fcp":848.3000001907349,"ttfb":265.9000005722046,"pageVisibility":"visible","entityId":10219,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"35c3d49d-69cc-4ffd-8b7f-1a5d9de78e73","navigationType":0,"readyForUser":899.7000007629395,"redirectCount":0,"resourceLoadedEnd":881.9000005722046,"resourceLoadedStart":271.70000076293945,"resourceTiming":[{"duration":27,"initiatorType":"link","name":"https://community.i2b2.org/jira/s/7fd763ecdf5ed1f47fc4d22fa8382e97-CDN/4x9nqn/820011/16zrvj4/49fa3aa3d35a2cc689cbf274e66cc41a/_/download/contextbatch/css/_super/batch.css","startTime":271.70000076293945,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":271.70000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":298.70000076293945,"responseStart":0,"secureConnectionStart":0},{"duration":27.59999942779541,"initiatorType":"link","name":"https://community.i2b2.org/jira/s/898b8076c5e82f53cd816ca393e45a56-CDN/4x9nqn/820011/16zrvj4/41b71ca9fb0eed92dc73e9510f2744ee/_/download/contextbatch/css/project.issue.navigator,jira.view.issue,jira.global,atl.general,-_super/batch.css?jira.create.linked.issue=true&richediton=true&whisper-enabled=true","startTime":271.9000005722046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":271.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":299.5,"responseStart":0,"secureConnectionStart":0},{"duration":247.69999980926514,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/4c9c503fe98f210445831b0d7b0cdc33-CDN/4x9nqn/820011/16zrvj4/49fa3aa3d35a2cc689cbf274e66cc41a/_/download/contextbatch/js/_super/batch.js?locale=en-US","startTime":272.1000003814697,"connectEnd":324.9000005722046,"connectStart":305,"domainLookupEnd":305,"domainLookupStart":305,"fetchStart":272.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":324.9000005722046,"responseEnd":519.8000001907349,"responseStart":343.80000019073486,"secureConnectionStart":314.6000003814697},{"duration":286.5,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/694e598c1ae48b0f96655173631cd247-CDN/4x9nqn/820011/16zrvj4/41b71ca9fb0eed92dc73e9510f2744ee/_/download/contextbatch/js/project.issue.navigator,jira.view.issue,jira.global,atl.general,-_super/batch.js?jira.create.linked.issue=true&locale=en-US&richediton=true&whisper-enabled=true","startTime":272.30000019073486,"connectEnd":453.20000076293945,"connectStart":433.5,"domainLookupEnd":433.5,"domainLookupStart":433.5,"fetchStart":272.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":453.30000019073486,"responseEnd":558.8000001907349,"responseStart":473.70000076293945,"secureConnectionStart":443.1000003814697},{"duration":228.30000019073486,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/53f54e0ac3f00bb56b136b4d2fff2853-CDN/4x9nqn/820011/16zrvj4/aae1242f5fc81cc6a5bb8bc963ccda29/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en-US","startTime":272.5,"connectEnd":484.70000076293945,"connectStart":461.5,"domainLookupEnd":461.5,"domainLookupStart":461.5,"fetchStart":272.5,"redirectEnd":0,"redirectStart":0,"requestStart":484.80000019073486,"responseEnd":500.80000019073486,"responseStart":499.9000005722046,"secureConnectionStart":472.9000005722046},{"duration":204.5999994277954,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/d41d8cd98f00b204e9800998ecf8427e-CDN/4x9nqn/820011/16zrvj4/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":272.70000076293945,"connectEnd":464.9000005722046,"connectStart":445.4000005722046,"domainLookupEnd":445.4000005722046,"domainLookupStart":445.4000005722046,"fetchStart":272.70000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":465,"responseEnd":477.30000019073486,"responseStart":476.5,"secureConnectionStart":454.9000005722046},{"duration":229.5,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/d41d8cd98f00b204e9800998ecf8427e-CDN/4x9nqn/820011/16zrvj4/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":272.9000005722046,"connectEnd":489.9000005722046,"connectStart":469.9000005722046,"domainLookupEnd":469.9000005722046,"domainLookupStart":469.9000005722046,"fetchStart":272.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":489.9000005722046,"responseEnd":502.4000005722046,"responseStart":501.5,"secureConnectionStart":479.80000019073486},{"duration":35.30000019073486,"initiatorType":"link","name":"https://community.i2b2.org/jira/s/30748292e4ca68be6947d7969829384b-CDN/4x9nqn/820011/16zrvj4/4f66da484ef7d95a2a604d3ab014374c/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":273,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":273,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":308.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":236.89999961853027,"initiatorType":"script","name":"https://community.i2b2.org/jira/rest/api/1.0/shortcuts/820011/a9e270f026ecabffc9a59343e5439391/shortcuts.js?context=issuenavigation&context=issueaction","startTime":273.20000076293945,"connectEnd":496.9000005722046,"connectStart":477.20000076293945,"domainLookupEnd":477.20000076293945,"domainLookupStart":477.20000076293945,"fetchStart":273.20000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":496.9000005722046,"responseEnd":510.1000003814697,"responseStart":508.9000005722046,"secureConnectionStart":486.70000076293945},{"duration":72.40000057220459,"initiatorType":"link","name":"https://community.i2b2.org/jira/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/4x9nqn/820011/16zrvj4/efa42a25652b26dfd802540c024826b3/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-jira.view.issue,-project.issue.navigator/batch.css?jira.create.linked.issue=true&richediton=true","startTime":399,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":399,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":471.4000005722046,"responseStart":0,"secureConnectionStart":0},{"duration":406.29999923706055,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/8087506fefd02b4096991c90836b49f6-CDN/4x9nqn/820011/16zrvj4/efa42a25652b26dfd802540c024826b3/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-jira.view.issue,-project.issue.navigator/batch.js?jira.create.linked.issue=true&locale=en-US&richediton=true","startTime":399.20000076293945,"connectEnd":790.3000001907349,"connectStart":766.5,"domainLookupEnd":766.5,"domainLookupStart":766.5,"fetchStart":399.20000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":790.4000005722046,"responseEnd":805.5,"responseStart":804.2000007629395,"secureConnectionStart":778.2000007629395},{"duration":392.69999980926514,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/d41d8cd98f00b204e9800998ecf8427e-CDN/4x9nqn/820011/16zrvj4/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":425.70000076293945,"connectEnd":806,"connectStart":786.5,"domainLookupEnd":786.5,"domainLookupStart":786.5,"fetchStart":425.70000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":806.2000007629395,"responseEnd":818.4000005722046,"responseStart":817.2000007629395,"secureConnectionStart":796.1000003814697},{"duration":411.80000019073486,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/d41d8cd98f00b204e9800998ecf8427e-CDN/4x9nqn/820011/16zrvj4/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":470.1000003814697,"connectEnd":868.5,"connectStart":844.9000005722046,"domainLookupEnd":844.9000005722046,"domainLookupStart":844.9000005722046,"fetchStart":470.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":868.5,"responseEnd":881.9000005722046,"responseStart":881.2000007629395,"secureConnectionStart":856.5},{"duration":164.69999980926514,"initiatorType":"xmlhttprequest","name":"https://community.i2b2.org/jira/rest/webResources/1.0/resources","startTime":695.1000003814697,"connectEnd":842,"connectStart":838,"domainLookupEnd":838,"domainLookupStart":838,"fetchStart":695.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":842.1000003814697,"responseEnd":859.8000001907349,"responseStart":859,"secureConnectionStart":838}],"fetchStart":147,"domainLookupStart":148,"domainLookupEnd":182,"connectStart":183,"connectEnd":225,"secureConnectionStart":196,"requestStart":225,"responseStart":266,"responseEnd":470,"domLoading":270,"domInteractive":981,"domContentLoadedEventStart":981,"domContentLoadedEventEnd":1018,"domComplete":1282,"loadEventStart":1282,"loadEventEnd":1283,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":962.8000001907349},{"name":"bigPipe.sidebar-id.end","time":963.6000003814697},{"name":"bigPipe.activity-panel-pipe-id.start","time":963.7000007629395},{"name":"bigPipe.activity-panel-pipe-id.end","time":964.7000007629395},{"name":"activityTabFullyLoaded","time":1033.8000001907349}],"measures":[],"correlationId":"3709096a903129","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":229,"dbReadsTimeInMs":35,"dbConnsTimeInMs":47,"applicationHash":"0629dd8d260e3954ece49053e565d01dabe11609","experiments":[]}}