add bcda
This commit is contained in:
@@ -79,7 +79,11 @@
|
||||
"WebFetch(domain:volkovlabs.io)",
|
||||
"Bash(grep:*)",
|
||||
"Bash(for f in /home/kert/.claude/projects/-home-kert-stack/*.jsonl)",
|
||||
"Bash(do grep -o '\"\"file_path\"\":\"\"[^\"\"]*\\\\.js\"\"' \"$f\")"
|
||||
"Bash(do grep -o '\"\"file_path\"\":\"\"[^\"\"]*\\\\.js\"\"' \"$f\")",
|
||||
"Bash(uv run ruff check:*)",
|
||||
"Bash(uv run:*)",
|
||||
"Bash(uvx ruff check:*)",
|
||||
"WebFetch(domain:bcda.cms.gov)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
BIN
dev/BCDA_Data_Dictionary.xlsx
Normal file
BIN
dev/BCDA_Data_Dictionary.xlsx
Normal file
Binary file not shown.
BIN
dev/BCDA_Partially_Adjudicated_Data_Dictionary.xlsx
Normal file
BIN
dev/BCDA_Partially_Adjudicated_Data_Dictionary.xlsx
Normal file
Binary file not shown.
400
dev/Coverage.ndjson
Normal file
400
dev/Coverage.ndjson
Normal file
File diff suppressed because one or more lines are too long
3347
dev/ExplanationOfBenefit.ndjson
Normal file
3347
dev/ExplanationOfBenefit.ndjson
Normal file
File diff suppressed because one or more lines are too long
100
dev/Patient.ndjson
Normal file
100
dev/Patient.ndjson
Normal file
@@ -0,0 +1,100 @@
|
||||
{"address":[{"state":"22"}],"birthDate":"1952-11-17","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000066","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000066"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"0e239e4895a76a2aff678507b1626a7cd08d23db07280e7efa228c8b0c156d23"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA66"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Schneider199","given":["Werner409"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1943-05-05","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"2","display":"Black","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000059","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000059"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"cb152b9ec654eeefaca147a0c73e053c0cdf962d10eb0b7ab494dcbd58a7e530"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA59"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Mann644","given":["Mohammad578"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1947-08-24","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000012","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000012"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"2aa27465b5d13f8ab80d0363095b72f252adf1f8a19e52896847de556d59765f"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA12"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Stroman228","given":["Jerilyn993"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01030","state":"22"}],"birthDate":"1945-07-20","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000091","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000091"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"8e6f12631bd513b4679498359c2d8c94f17ab65e018885db8ab49063701b1a01"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA91"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Bahringer146","given":["Marisela850"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02420","state":"22"}],"birthDate":"1945-03-24","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"4","display":"Asian","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000028","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000028"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"b621177b13f7a5266318f12cc5c899dec1423fc030b3e7855ecdb2b2409a41b7"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA28"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Orn563","given":["Magdalene960"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01945","state":"22"}],"birthDate":"1945-06-17","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000061","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000061"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"13b1f31213081e69e67a268168a115372fc93707613158e0136e824889762689"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA61"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Fadel536","given":["Julian715"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02169","state":"22"}],"birthDate":"1950-02-14","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000029","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000029"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"6a2e103b37088caad8b877bf8da8209eb4459f66beea8357da8a21e3d92c255f"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA29"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Tillman293","given":["Benny518"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01854","state":"22"}],"birthDate":"1947-01-23","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000069","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000069"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"d5fa44f3f780edfab2382c5006ed0df39690a6f81719bfda71d2f4df84729e4d"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA69"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Ziemann98","given":["Lavada531"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1948-06-23","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000060","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000060"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"715b1a567063cba0060bca2774782d5587787796d3be60ae8bd654552420bc5d"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA60"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"O'Conner199","given":["Bernard308"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01902","state":"22"}],"birthDate":"1943-04-17","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000096","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000096"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"3cb71a2eb66efe03647ed24a197f8648d06e5f3f4168bf3b9f397a97ae8d71fc"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA96"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Hilll811","given":["Armando772"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1942-09-08","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000047","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000047"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"f0a033c591cb5d7da380c4a14861acbc8da3b851e5946b758d0ce60cbc5d3ce2"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA47"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Kozey370","given":["Lyla842"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02163","state":"22"}],"birthDate":"1947-05-27","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000077","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000077"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"1b9c6fa4b1943d4b98bf032abc37bc5c83612924c438c71dcf11a1513dd857fc"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA77"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Collins926","given":["Pierre431"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02472","state":"22"}],"birthDate":"1953-11-09","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000003","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000003"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"86ef05caba22c3323df3c12f84f882e8de694d33c6c5ba7f46f63bb88f859b90"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA01"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Gislason620","given":["Miki234"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1948-06-13","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000080","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000080"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"df8545244a052f9a305bf265180294cfa83449824987bc3afe383fb8274d7e75"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA80"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Upton904","given":["Forest317"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02542","state":"22"}],"birthDate":"1943-10-06","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000027","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000027"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"0b4f69a405835f92292d93229b5a1fb2adbfefa327b3be0e182ca6c2e87e2c85"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA27"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"King743","given":["Terry864"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01013","state":"22"}],"birthDate":"1947-12-26","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000006","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000006"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"22c49cceafa888001eaf30b0edd1d0fed39897e0de0218fc439e5d7817352b94"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA06"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Block661","given":["Franklin857"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02145","state":"22"}],"birthDate":"1941-08-28","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000064","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000064"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"0a88f463d134cc31b5c8f17ba3307b0ead9269a00be2701b47b117b57abe0454"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA64"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Funk324","given":["Myles862"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1943-11-20","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000073","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000073"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"9f4da7606df5ba3e58df7ef3e894286dd93d2138535e272e251d3b8d3afffaba"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA73"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Bednar518","given":["Sharlene906"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01901","state":"22"}],"birthDate":"1952-07-07","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000055","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000055"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"2decf041177c8188e9ede56f143426d9fd1b008f93e8f3a6541838c278a991ba"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA55"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Strosin214","given":["Paris331"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1948-08-01","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000084","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000084"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"0d6d9b6f03402e6c54e8ae4802786cafdd1a83a7b7e4a61a71316c1365bb37b0"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA84"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Thiel172","given":["Georgine810"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1952-12-21","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000082","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000082"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"fa2174700fe031846d754fa96c3441376b62cc18b5684994ba5cce98617ca18a"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA82"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Haley279","given":["Molly175"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01835","state":"22"}],"birthDate":"1942-07-02","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"5","display":"Hispanic","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000049","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000049"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"b5e1c841382a9656e7f318d256c0b81149f39169868602542ef58e83bf042fdb"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA49"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Quiroz936","given":["Roberto515"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01104","state":"22"}],"birthDate":"1949-06-24","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000022","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000022"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"2164cab0bda5e546c57adf5796a22fae41eee91a79f07f045fe6ff2e03eb33b6"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA22"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Hickle134","given":["Benton624"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1952-08-17","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000054","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000054"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"df71905afdcd0d517900d70d8bc696ecfb17e1b275f874257c02789aeb19eae5"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA54"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Williamson769","given":["Leif534"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02446","state":"22"}],"birthDate":"1951-06-12","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000014","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000014"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"74ca777c77463a2e764a0eda6b66803031c3217cb7b39449e6727652bff3c22b"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA14"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Price929","given":["Lavinia262"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02131","state":"22"}],"birthDate":"1948-09-10","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000070","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000070"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"9703479f931f50cb91daa94b8b6859d7538ba63018bcf690aeb178e4bc568eec"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA70"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Price929","given":["Karena692"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1945-06-03","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000008","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000008"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"cb56534307c081c028bd729c9a0fe9f9d21bc1f880a610e2d99cd30dcb77033b"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA08"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Strosin214","given":["Erline657"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02138","state":"22"}],"birthDate":"1951-08-13","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000000","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000000"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"969db7ab9b45d684fbe66e20346c07149dc164e88348cbb7c8f7a98b9b8f71ed"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00FZ00"}],"meta":{"lastUpdated":"2021-09-23T13:36:42.530-04:00"},"name":[{"family":"Hoppe518","given":["Sal878"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01106","state":"22"}],"birthDate":"1944-10-12","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000063","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000063"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"650032c863ebf0c6ee57fa5a6d8e237515310847a54bcd95493b6fe37bd5a406"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA63"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Wunsch504","given":["Dovie983"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01604","state":"22"}],"birthDate":"1948-12-23","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"5","display":"Hispanic","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000095","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000095"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"8268f3744d59d506d9cc228e4b5327084345a288a9111f97242f5a0914fd1179"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA95"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Pulido715","given":["Emilia403"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1943-02-16","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000075","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000075"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"77fe7181a5951cd4ebbbf14b1082ac9b6573409dc43ecb00664da9af91dc7a4e"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA75"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Lubowitz58","given":["Ariel183"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1955-05-13","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000089","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000089"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"c88119aea4de6aec214c1a3e7e4dece875311dca6007508a747811b107c8c072"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA89"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Crooks415","given":["Lou594"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01851","state":"22"}],"birthDate":"1954-07-31","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000050","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000050"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"fb9950037d66dbd9ca1e0aa8f3712cef453cc27405f3058cbec399a90a44a724"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA50"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Kilback373","given":["Lashawnda573"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1954-06-28","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000085","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000085"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"ece2df5338e15972e2e9d94bb24cf2886e3f2a95bd02d20b93f1565d4683e064"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA85"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"VonRueden376","given":["Isadora719"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02302","state":"22"}],"birthDate":"1947-03-13","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000053","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000053"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"6ac8e8b446dd69566dc36a8d32db264bad7e8098455ae087d00b74b7ac6107cc"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA53"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Denesik803","given":["Cecil300"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01940","state":"22"}],"birthDate":"1951-07-04","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000041","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000041"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"b7dc1288d7991370f64e3ac5f7cc589113c1aa307d2ec5e5e640937e50a2a82a"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA41"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Ward668","given":["Tony646"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02108","state":"22"}],"birthDate":"1951-08-13","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"5","display":"Hispanic","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000092","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000092"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"fc976be8b7e223d5585030b33ea094687b8daee3bea7244403889bb03f011984"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA92"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Predovic534","given":["Grady603"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02343","state":"22"}],"birthDate":"1952-05-08","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000039","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000039"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"85b990c88a85c5720e649effbc513b7f09d44702810b9ab052950788023ccc82"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA39"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Lang846","given":["Hershel911"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1953-04-29","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000052","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000052"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"cb8059f7fed7796f210c1f13c49c5b4f24ea06a3d350574b0be37a90326f7678"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA52"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Abshire638","given":["Gracie337"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02148","state":"22"}],"birthDate":"1952-08-29","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000019","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000019"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"3c3e8090a3cd73d58262bcd5a6745ac14d2b945aef4f2a3820f293b973085da5"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA19"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Purdy2","given":["Verla696"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1949-08-22","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000087","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000087"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"e30cee495d1e85a8fa0cc0a7d6e7b089c710d68e49c7fd18a92d3040b1667575"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA87"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Emard19","given":["Eugenio846"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1953-01-16","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"4","display":"Asian","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000079","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000079"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"26dc0f42edd72117ee3c26b9b02c39d2ca5bc798241acefb57e644b652325899"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA79"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Kovacek682","given":["Jacob959"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02019","state":"22"}],"birthDate":"1949-12-08","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000005","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000005"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"8e7c3da60acfd4a27713dc7a9258ac4ffe4758c4416671f5ff423088496b3288"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA05"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Murazik203","given":["Yolonda722"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01840","state":"22"}],"birthDate":"1950-02-14","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000035","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000035"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"029fe14206b2a97e2ed155868fedc3864b092c5110510f232ed796fc1f15ca73"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA35"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Dibbert990","given":["Christal240"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1950-10-24","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"5","display":"Hispanic","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000056","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000056"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"bcb606c89a75a0f9ac74889ba2f77ef06fbb03d8e6a95c90656f29840c99f971"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA56"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Shields502","given":["Maye976"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1941-04-18","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"5","display":"Hispanic","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000034","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000034"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"9c65cbdd88f5f7d7373eaac5f05a9b64a894f4425c9859b177bf9903f44d4ac3"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA34"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Ritchie586","given":["Edward499"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02453","state":"22"}],"birthDate":"1954-08-09","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000015","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000015"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"969ddbb51a0718fe194213633447d4f9669842aee34cc0d8e16aeae53ed8d9d7"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA15"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Will178","given":["Esther279"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1947-09-09","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"5","display":"Hispanic","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000057","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000057"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"24f25766490a09f90e90ac0814a2e6dacbcf46cbd91a14752b1ad8a70528de0f"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA57"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Wisozk929","given":["Keena534"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02138","state":"22"}],"birthDate":"1951-04-19","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000045","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000045"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"aa0c872a126ff6fb6dec6ca7f3fba77f48ec36f5944120ff2da41c57b5765d24"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA45"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Rice937","given":["Jonathon205"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02453","state":"22"}],"birthDate":"1941-01-29","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000037","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000037"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"4ebcd90d4d7ba7ba144e70363c042b1a9a55b22a5f63cd2dd031a95a832c76ea"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA37"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Stroman228","given":["Margarite168"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01930","state":"22"}],"birthDate":"1942-06-15","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000094","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000094"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"f38cc8de4331c0bb18f04d0e2e228876101c22354f4ee966bbeb097104f0e306"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA94"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"McClure239","given":["Arlie183"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02050","state":"22"}],"birthDate":"1947-04-25","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000067","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000067"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"3cbc691291770c0da1351c72c4fa0293795f087e6219cb92bd928a87a20be5ea"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA67"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Robel940","given":["Alexander630"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01830","state":"22"}],"birthDate":"1947-03-18","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000088","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000088"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"dfa2e133ab0e0d3275fa4dd1400934fc1942cc49ff2ee9c1d6e663908ed5c215"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA88"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Considine820","given":["Barton704"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1950-05-15","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"2","display":"Black","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000072","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000072"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"2b9c032fb699ab0bf96de90210862b2f43ea3e14a26ed9a002c86df635936504"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA72"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Jacobs452","given":["Isiah14"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01906","state":"22"}],"birthDate":"1950-05-15","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000026","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000026"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"352d5aeea5dfddb8927cae47f76273eb02fee367174568579c7407c6bc979201"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA26"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Murazik203","given":["Rosalia943"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1950-07-19","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000038","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000038"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"601907214b0688b084269028d649fbaef04db7c707f686d372dab53462201974"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA38"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Pouros728","given":["Felton646"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02130","state":"22"}],"birthDate":"1954-01-03","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000048","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000048"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"7d14936582cc1f2671f4fceebc4b8ea3b6323cc983a8264c2383a2ce5c357077"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA48"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Treutel973","given":["Gerry91"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02169","state":"22"}],"birthDate":"1953-08-15","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000007","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000007"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"79d88b4723ffe0418b4ffa4ef7dc3a6f30cc74e66fd26e277c9305ca75c5d1ef"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA07"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Blanda868","given":["Maddie576"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02115","state":"22"}],"birthDate":"1942-03-24","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000099","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000099"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"f0ee9f4420bc86a20937a2405b77adb1d8cb495920ba0c29e3ea8124fdc9fb4a"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA99"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Okuneva707","given":["Chase54"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1955-03-20","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"5","display":"Hispanic","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000016","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000016"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"defb20c0b7765fb2fc75918cbc88d0feb09cbc3e227e11cc44014d42f8f5e3e1"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA16"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Tromp100","given":["Franklyn361"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02136","state":"22"}],"birthDate":"1952-10-14","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000004","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000004"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"d8d51fdac173a92065654bead47d678dc18bb473c06be14de2a67a2ef0be4ef1"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA04"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Bashirian201","given":["Rueben647"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02140","state":"22"}],"birthDate":"1944-08-31","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"5","display":"Hispanic","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000001","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000001"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"ff16e456d68f085c96f0617db7fcc3b1df1c4ea469c583160e445bc7a2c0b455"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA02"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Valverde277","given":["Beatriz277"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1950-02-02","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000030","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000030"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"1726b952f6fec4cac1d51265722b8a15ed3d4c7a4dd91baf738ec26efd51e912"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA30"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Reynolds644","given":["Grace552"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1951-07-25","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"4","display":"Asian","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000081","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000081"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"6290a62162d60a1119208752fb68e17b2554ce603fc533f75f9cb9a2991d2a66"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA81"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Littel644","given":["Maxwell782"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02140","state":"22"}],"birthDate":"1955-08-01","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000078","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000078"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"3498961df327dc87f2298aa1f9235d9549af0f578f1a7ae09e9314f6e478c453"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA78"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Waelchi213","given":["Irvin970"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02472","state":"22"}],"birthDate":"1954-12-11","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"2","display":"Black","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000043","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000043"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"738a871a832c266d01344aab25edf9e6c3db80b491fbe5c50955fe334f70155d"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA43"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Hahn503","given":["Pattie91"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01890","state":"22"}],"birthDate":"1949-10-28","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000024","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000024"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"28f636ce152cd2ee41e2a547146461e081b09c6c8eaeedd958b20300cdbd5283"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA24"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Davis923","given":["Pei116"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02148","state":"22"}],"birthDate":"1947-07-14","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"4","display":"Asian","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000033","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000033"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"cff608549f9daf61de5f9002e6cae5001318a828cffc91ef7ec997b9c4ed50f4"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA33"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Hoeger474","given":["Cassi819"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02149","state":"22"}],"birthDate":"1942-09-17","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000042","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000042"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"d840bf5bccd64cafcfa7bb6e3f5cca6388e10bae0a15f1471070fed4ea07bda7"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA42"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Koss676","given":["Dimple273"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1947-01-16","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"4","display":"Asian","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000032","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000032"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"a1a2bbd5f9e809ee9c7a23a38baeebce78221a74374e2fbe5567c8a219b4a0f6"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA32"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Watsica258","given":["Denny560"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1951-12-30","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000023","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000023"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"a4c508bdac475ae40b4966da120cba58b3def1a33568dc528d7967ccb32bfd15"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA23"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Heathcote539","given":["Bonita405"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02532","state":"22"}],"birthDate":"1949-06-24","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000058","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000058"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"12f60d824954a17cf2c0d004ce070f4d9b1b598393532ef32196357f1461d576"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA58"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Hudson301","given":["Edison640"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02184","state":"22"}],"birthDate":"1943-01-23","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000046","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000046"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"42f268b1722b1a4d13df474a503f84af696a17643422d706bf6a43cfc6d041ac"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA46"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Gottlieb798","given":["Elwood28"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02360","state":"22"}],"birthDate":"1944-12-18","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000021","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000021"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"5e84167703db4bd85bc8cfce8dd32f69059a0fcbf31bec4034e0e9da8532b64d"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA21"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Kuhlman484","given":["Tommye961"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1948-05-14","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000011","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000011"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"cc91e2b1285f175335081689c2109d97b79ec55b324c08ba6d69d59e3f00607a"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA11"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Reichel38","given":["Lashell363"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01970","state":"22"}],"birthDate":"1950-05-16","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"5","display":"Hispanic","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000083","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000083"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"06332c2f2385a7fd5c982a1ea55451849bd92cac7429a454ca479f8dfc57b7f8"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA83"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Morales679","given":["Catalina187"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1948-11-21","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"5","display":"Hispanic","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000025","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000025"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"4dd837f82eed17e32af505660db07d8993ef54ca334944c4032a9813c6c3c231"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA25"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Delarosa409","given":["Carlota980"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1945-05-12","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"2","display":"Black","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000002","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000002"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"74c7019a8bbfd08741233982c648b06e27613a007a708946ef45a8f64c22afdb"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA03"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Herzog843","given":["Jerrold404"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02718","state":"22"}],"birthDate":"1944-04-30","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000076","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000076"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"635508b624763ba57e0717635f92b91abbad377731fa2ff88c61f2e7cec3e128"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA76"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Frami345","given":["Emerson869"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02128","state":"22"}],"birthDate":"1950-02-05","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"5","display":"Hispanic","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000071","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000071"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"e4656b9b5cf11876a7bfd9f3aa1c9175cf30fe1c3e4e16e1800ac28753749cea"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA71"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Jaramillo133","given":["Ernesto186"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02351","state":"22"}],"birthDate":"1948-07-29","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000020","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000020"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"e6e4a7493a0186d08afa620a5bde80c984ad2d008ce201621a64af72ca516cd7"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA20"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Lind531","given":["Jessia669"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1949-03-17","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000044","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000044"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"4f3e5b43f7a6e56e6cdc5b621ac69c1e6462fa5f83141a08ded7cb3f59d099b1"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA44"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Block661","given":["Micheal721"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1954-01-19","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000065","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000065"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"39290e63285f4205f8e0ffc37dd1f479b16bc7f5b6dd3d1e5fbac5cbacff7b01"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA65"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Erdman779","given":["Isa815"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02151","state":"22"}],"birthDate":"1942-01-14","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"5","display":"Hispanic","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000017","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000017"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"9b4a5d782fdc996243e1dde086b66f0705bbe8b88fa62c80a49ab2623431facc"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA17"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Muro989","given":["Julio255"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02141","state":"22"}],"birthDate":"1948-12-29","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000040","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000040"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"b5b4dfadb5e590aba154a66cea6403bfa4658d062447c6f53702eba9df6be825"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA40"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Windler79","given":["Ernestina649"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02108","state":"22"}],"birthDate":"1951-05-17","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000018","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000018"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"502ec2924e07e94feb870636c8a0cd6e377b124bfb4c70b977f31016c5cfb29e"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA18"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Cole117","given":["Sue491"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1951-04-23","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"2","display":"Black","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000093","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000093"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"b0dc1c72022af9a46e17c28f0dc9810871ea820fc5f13d919bb92e411ff1d7a7"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA93"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Satterfield305","given":["Trinidad33"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1951-02-15","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000074","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000074"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"02b5b2acdfdb0fb7ae936179bbec581408402b5bd1de7343fb03653bbae57212"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA74"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Deckow585","given":["Mardell937"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1954-12-01","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000062","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000062"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"ac7b70d8ed559352b4b51f7f9836296435174951e9c02c7ba0beeb2159f2e582"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA62"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Breitenberg711","given":["Wallace647"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02472","state":"22"}],"birthDate":"1950-08-15","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000086","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000086"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"553065236f0befdfb1c2f52818f377784798d804f58def6498e4e61fa1bd9427"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA86"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Funk324","given":["Kasi212"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01830","state":"22"}],"birthDate":"1954-03-15","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000013","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000013"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"5ca0239992799733a14be12043eea6ae0f28e3ff21c3bded97a14ecaef90f023"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA13"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Deckow585","given":["Zelda766"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02120","state":"22"}],"birthDate":"1943-07-21","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000098","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000098"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"4d67bb28e055ea2bd1384bf3762dc8c2e6bff533d2c58874cabe07d84aeaf835"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA98"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Rempel203","given":["Adriana394"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1950-06-01","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000097","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000097"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"701e8a351aaface3e662015950870698a0c170174a86b92acf8fb34f96339acd"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA97"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Gulgowski816","given":["Ermelinda113"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1952-10-02","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000090","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000090"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"664577d0ad8169481f35bd6d2a3eb6832bebf3f960cb84333f2ac38c0e74629f"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA90"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Cassin499","given":["Thomasena108"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02145","state":"22"}],"birthDate":"1945-03-11","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000036","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000036"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"8fea6d49397a42da7ba3cc6c03deaadee6f0340a5f457bac8880012aff2ceb5a"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA36"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Smitham825","given":["Lavonia8"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1953-12-30","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000031","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000031"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"71712193332d97faf7d4fabf23f0ff28d2ef880e9bc8be1df38606b459b1aca2"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA31"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Johns824","given":["Doyle959"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1954-04-11","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000051","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000051"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"fde023171f4511ffa8d53f9d7da54b1acf9ce2abdbe9c155de80b1bf2dfcc2c6"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA51"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Shields502","given":["Jacquelynn434"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"state":"22"}],"birthDate":"1954-12-21","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000009","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000009"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"8ecae5fafe3e854872a3f30721ee41e4bd5fe237f5a2934fd909cc7301ea878a"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA09"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Durgan499","given":["Laurena366"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"01906","state":"22"}],"birthDate":"1948-12-17","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"male","id":"-10000000000068","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000068"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"b1521273a20a20a3697e8d6fd844519d99dc000fcb42c424910e039bcf4e7a8d"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA68"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Kautzer186","given":["Kevin729"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"postalCode":"02457","state":"22"}],"birthDate":"1941-10-11","extension":[{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"2021"}],"gender":"female","id":"-10000000000010","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","value":"-10000000000010"},{"system":"https://bluebutton.cms.gov/resources/identifier/mbi-hash","value":"1ac550d7222619f018f36fbdd48189058db6bbb5ca950b05d1a0626a9f745a72"},{"extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://hl7.org/fhir/sid/us-mbi","value":"1S00E00AA10"}],"meta":{"lastUpdated":"2021-08-17T13:43:00.037-04:00"},"name":[{"family":"Price929","given":["Kari181"],"use":"usual"}],"resourceType":"Patient"}
|
||||
200
dev/bcda_v2/Coverage.ndjson
Normal file
200
dev/bcda_v2/Coverage.ndjson
Normal file
File diff suppressed because one or more lines are too long
2021
dev/bcda_v2/ExplanationOfBenefit.ndjson
Normal file
2021
dev/bcda_v2/ExplanationOfBenefit.ndjson
Normal file
File diff suppressed because one or more lines are too long
50
dev/bcda_v2/Patient.ndjson
Normal file
50
dev/bcda_v2/Patient.ndjson
Normal file
@@ -0,0 +1,50 @@
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000178","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000178"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"7SM0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"47"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000136","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000136"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"1SG0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000145","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000145"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"1SH0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"47"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000177","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000177"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"6SM0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000143","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000143"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"8SG0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000152","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000152"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"8SH0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"45"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000174","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000174"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"3SM0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000173","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000173"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"2SM0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"10"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000138","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000138"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"3SG0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"21"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000168","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000168"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"6SK0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"51"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000161","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000161"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"8SJ0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000141","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000141"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"6SG0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"47"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000139","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000139"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"4SG0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000160","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000160"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"7SJ0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"07"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000183","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000183"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"3SN0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"10"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000148","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000148"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"4SH0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000166","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000166"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"4SK0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"31"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000163","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000163"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"1SK0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"30"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000150","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000150"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"6SH0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"10"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000164","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000164"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"2SK0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000162","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000162"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"9SJ0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000182","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000182"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"2SN0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000158","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000158"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"5SJ0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"05"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000140","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000140"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"5SG0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"31"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"2","display":"Black","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000154","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000154"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"1SJ0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000171","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000171"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"9SK0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"4","display":"Asian","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000181","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000181"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"1SN0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"10"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000156","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000156"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"3SJ0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000180","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000180"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"9SM0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000157","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000157"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"4SJ0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000159","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000159"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"6SJ0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000142","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000142"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"7SG0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000184","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000184"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"4SN0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000172","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000172"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"1SM0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000149","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000149"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"5SH0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"47"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000170","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000170"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"8SK0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"2","display":"Black","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000144","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000144"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"9SG0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000153","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000153"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"9SH0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000146","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000146"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"2SH0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"47"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000137","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000137"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"2SG0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000179","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000179"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"8SM0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000167","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000167"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"5SK0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000185","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000185"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"5SN0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"33"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"3","display":"Other","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000165","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000165"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"3SK0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000169","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000169"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"7SK0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"34"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000176","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000176"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"5SM0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000175","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000175"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"4SM0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000155","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000155"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"2SJ0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"30"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"female","id":"-19990000000151","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000151"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"7SH0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["Jane","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
{"address":[{"city":"PODUNK","line":["1000 MAIN ST","APT ABC"],"postalCode":"99999","state":"22"}],"birthDate":"1999-06-01","deceasedDateTime":"1981-03-17","extension":[{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248153007"},{"url":"https://bluebutton.cms.gov/resources/variables/race","valueCoding":{"code":"1","display":"White","system":"https://bluebutton.cms.gov/resources/variables/race"}},{"extension":[{"url":"ombCategory","valueCoding":{"code":"UNK","display":"Unknown","system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}},{"url":"text","valueString":"Unknown"}],"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"},{"url":"https://bluebutton.cms.gov/resources/variables/rfrnc_yr","valueDate":"0003"},{"url":"https://bluebutton.cms.gov/resources/variables/dual_01","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_01"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_02","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_02"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_03","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_03"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_04","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_04"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_05","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_05"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_06","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_06"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_07","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_07"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_08","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_08"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_09","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_09"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_10","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_10"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_11","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_11"}},{"url":"https://bluebutton.cms.gov/resources/variables/dual_12","valueCoding":{"code":"AA","system":"https://bluebutton.cms.gov/resources/variables/dual_12"}}],"gender":"male","id":"-19990000000147","identifier":[{"system":"https://bluebutton.cms.gov/resources/variables/bene_id","type":{"coding":[{"code":"MB","display":"Member Number","system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"-19990000000147"},{"period":{"start":"2020-01-01"},"system":"http://hl7.org/fhir/sid/us-mbi","type":{"coding":[{"code":"MC","display":"Patient's Medicare number","extension":[{"url":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency","valueCoding":{"code":"current","display":"Current","system":"https://bluebutton.cms.gov/resources/codesystem/identifier-currency"}}],"system":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},"value":"3SH0A00AA00"}],"meta":{"lastUpdated":"2021-06-08T01:50:48.169+00:00","profile":["http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"]},"name":[{"family":"Doe","given":["John","X"],"use":"usual"}],"resourceType":"Patient"}
|
||||
221
dev/generate_zot_tables.py
Normal file
221
dev/generate_zot_tables.py
Normal file
@@ -0,0 +1,221 @@
|
||||
"""Introspect the Zotero SQLite database and generate Pydantic table models.
|
||||
|
||||
Usage:
|
||||
uv run python generate_zot_tables.py [--db PATH] [--out DIR]
|
||||
|
||||
Defaults:
|
||||
--db ../zotero/data/zotero.sqlite
|
||||
--out ../src/bib/table/
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import re
|
||||
import sqlite3
|
||||
from pathlib import Path
|
||||
|
||||
# ── SQLite type → Python type annotation mapping ─────────────────────────────
|
||||
|
||||
SQLITE_TYPE_MAP: dict[str, str] = {
|
||||
"TEXT": "str",
|
||||
"INT": "int",
|
||||
"INTEGER": "int",
|
||||
"REAL": "float",
|
||||
"BLOB": "bytes",
|
||||
"BOOLEAN": "bool",
|
||||
"TIMESTAMP": "str",
|
||||
"NONE": "str",
|
||||
"": "str",
|
||||
}
|
||||
|
||||
|
||||
def python_type(sqlite_type: str) -> str:
|
||||
"""Map a SQLite column type to a Python type annotation string."""
|
||||
upper = sqlite_type.upper().strip()
|
||||
if upper in SQLITE_TYPE_MAP:
|
||||
return SQLITE_TYPE_MAP[upper]
|
||||
# Handle VARCHAR(N), CHAR(N), etc.
|
||||
if re.match(r"(VAR)?CHAR", upper):
|
||||
return "str"
|
||||
return "str" # fallback
|
||||
|
||||
|
||||
# ── Name helpers ─────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def to_class_name(table: str) -> str:
|
||||
"""Convert a table name to PascalCase class name.
|
||||
|
||||
camelCase table names like 'itemAttachments' → 'ItemAttachments'.
|
||||
snake_case table names like 'fulltext_items' → 'FulltextItems'.
|
||||
"""
|
||||
# Split on underscores first
|
||||
parts = table.split("_")
|
||||
result = []
|
||||
for part in parts:
|
||||
if not part:
|
||||
continue
|
||||
# Split camelCase: 'itemAttachments' → ['item', 'Attachments']
|
||||
tokens = re.sub(r"([a-z])([A-Z])", r"\1_\2", part).split("_")
|
||||
for token in tokens:
|
||||
result.append(token.capitalize())
|
||||
return "".join(result)
|
||||
|
||||
|
||||
def sanitize_field(name: str) -> str:
|
||||
"""Ensure a column name is a valid Python identifier."""
|
||||
if name.isidentifier():
|
||||
return name
|
||||
cleaned = name.replace(" ", "_").replace("-", "_")
|
||||
if cleaned[0:1].isdigit():
|
||||
cleaned = f"f_{cleaned}"
|
||||
return cleaned
|
||||
|
||||
|
||||
# ── Introspection ────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def get_tables(con: sqlite3.Connection) -> list[str]:
|
||||
"""Return all user tables, sorted alphabetically."""
|
||||
rows = con.execute(
|
||||
"SELECT name FROM sqlite_master WHERE type='table' "
|
||||
"ORDER BY name"
|
||||
).fetchall()
|
||||
return [r[0] for r in rows]
|
||||
|
||||
|
||||
def get_columns(
|
||||
con: sqlite3.Connection, table: str
|
||||
) -> list[tuple[str, str, bool]]:
|
||||
"""Return [(col_name, sqlite_type, nullable), ...].
|
||||
|
||||
SQLite PRAGMA table_info returns:
|
||||
cid, name, type, notnull, dflt_value, pk
|
||||
A column is nullable if notnull == 0 and it's not a primary key.
|
||||
"""
|
||||
rows = con.execute(f'PRAGMA table_info("{table}")').fetchall()
|
||||
result = []
|
||||
for row in rows:
|
||||
col_name = row[1]
|
||||
col_type = row[2]
|
||||
notnull = row[3]
|
||||
is_pk = row[5]
|
||||
nullable = notnull == 0 and is_pk == 0
|
||||
result.append((col_name, col_type, nullable))
|
||||
return result
|
||||
|
||||
|
||||
# ── Code generation ──────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def generate_model(
|
||||
table: str, columns: list[tuple[str, str, bool]]
|
||||
) -> tuple[str, set[str]]:
|
||||
"""Generate a single Pydantic model class for a Zotero table."""
|
||||
cls = to_class_name(table)
|
||||
all_imports: set[str] = set()
|
||||
field_lines: list[str] = []
|
||||
|
||||
for col_name, col_type, nullable in columns:
|
||||
py = python_type(col_type)
|
||||
fname = sanitize_field(col_name)
|
||||
if nullable:
|
||||
annotation = f"{py} | None = None"
|
||||
else:
|
||||
annotation = py
|
||||
field_lines.append(f" {fname}: {annotation}")
|
||||
|
||||
lines = [
|
||||
f"class {cls}(SQLTable):",
|
||||
f' """Zotero table: {table}"""',
|
||||
"",
|
||||
' __schema__ = "zotero"',
|
||||
f' __tablename__ = "{table}"',
|
||||
"",
|
||||
*field_lines,
|
||||
]
|
||||
|
||||
return "\n".join(lines), all_imports
|
||||
|
||||
|
||||
def generate_module(
|
||||
con: sqlite3.Connection,
|
||||
tables: list[str],
|
||||
) -> str:
|
||||
"""Generate a full Python module for all Zotero tables."""
|
||||
all_imports: set[str] = {
|
||||
"from __future__ import annotations",
|
||||
"from aco.table.base import SQLTable",
|
||||
}
|
||||
models: list[str] = []
|
||||
|
||||
for table in tables:
|
||||
columns = get_columns(con, table)
|
||||
if not columns:
|
||||
continue
|
||||
model_code, imp = generate_model(table, columns)
|
||||
all_imports |= imp
|
||||
models.append(model_code)
|
||||
|
||||
sorted_imports = sorted(all_imports)
|
||||
header = "\n".join(sorted_imports)
|
||||
body = "\n\n\n".join(models)
|
||||
|
||||
return f"{header}\n\n\n{body}\n"
|
||||
|
||||
|
||||
# ── Main ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Generate Pydantic models from Zotero SQLite"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--db",
|
||||
default="../zotero/data/zotero.sqlite",
|
||||
help="Path to Zotero SQLite file",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--out",
|
||||
default="../src/bib/table",
|
||||
help="Output directory",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
db_path = Path(args.db)
|
||||
out_dir = Path(args.out)
|
||||
out_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
if not db_path.exists():
|
||||
print(f"Error: database not found at {db_path}")
|
||||
raise SystemExit(1)
|
||||
|
||||
con = sqlite3.connect(f"file:{db_path}?mode=ro", uri=True)
|
||||
|
||||
tables = get_tables(con)
|
||||
print(f"Found {len(tables)} tables in {db_path}")
|
||||
|
||||
# Generate single module with all tables
|
||||
module_path = out_dir / "zotero.py"
|
||||
code = generate_module(con, tables)
|
||||
module_path.write_text(code)
|
||||
print(f"Wrote {module_path} ({len(tables)} tables)")
|
||||
|
||||
# Write __init__.py
|
||||
init_lines = [
|
||||
'"""Pydantic models for all Zotero SQLite tables."""',
|
||||
"",
|
||||
"from .zotero import * # noqa: F401,F403",
|
||||
"",
|
||||
]
|
||||
(out_dir / "__init__.py").write_text("\n".join(init_lines))
|
||||
print(f"Wrote {out_dir / '__init__.py'}")
|
||||
|
||||
con.close()
|
||||
print(f"\nDone: {len(tables)} tables → {out_dir}/")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
492
dev/migrate_zotero.py
Normal file
492
dev/migrate_zotero.py
Normal file
@@ -0,0 +1,492 @@
|
||||
"""One-time migration from Zotero SQLite (EAV) to bib SQLite (denormalized).
|
||||
|
||||
Reads ``zotero.sqlite`` (61-table EAV schema with 4-5 joins per item)
|
||||
and writes ``bib.sqlite`` (8-table denormalized schema).
|
||||
|
||||
Usage::
|
||||
|
||||
uv run python dev/migrate_zotero.py \\
|
||||
--src zotero/data/zotero.sqlite \\
|
||||
--dst data/bib.sqlite
|
||||
|
||||
Mapping:
|
||||
Zotero itemType → bib item_type:
|
||||
- statute (code="FR") → rule
|
||||
- statute (code="C.F.R.") → regulation
|
||||
- report → manual
|
||||
- webpage → download
|
||||
- document → source
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import sqlite3
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Ensure project root is on sys.path for bib imports
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "src"))
|
||||
|
||||
from bib.store import Store # noqa: E402
|
||||
|
||||
|
||||
def _read_zotero(src: str) -> sqlite3.Connection:
|
||||
"""Open Zotero SQLite read-only."""
|
||||
con = sqlite3.connect(f"file:{src}?mode=ro", uri=True)
|
||||
con.row_factory = sqlite3.Row
|
||||
return con
|
||||
|
||||
|
||||
def _get_item_fields(zcon: sqlite3.Connection, item_id: int) -> dict:
|
||||
"""Read all fields for a Zotero item via the EAV join."""
|
||||
rows = zcon.execute(
|
||||
"""SELECT f.fieldName, idv.value
|
||||
FROM itemData id
|
||||
JOIN fields f ON id.fieldID = f.fieldID
|
||||
JOIN itemDataValues idv ON id.valueID = idv.valueID
|
||||
WHERE id.itemID = ?""",
|
||||
(item_id,),
|
||||
).fetchall()
|
||||
return {r["fieldName"]: r["value"] for r in rows}
|
||||
|
||||
|
||||
def _get_item_tags(zcon: sqlite3.Connection, item_id: int) -> list[str]:
|
||||
"""Read tags for a Zotero item."""
|
||||
rows = zcon.execute(
|
||||
"""SELECT t.name FROM itemTags it
|
||||
JOIN tags t ON it.tagID = t.tagID
|
||||
WHERE it.itemID = ?""",
|
||||
(item_id,),
|
||||
).fetchall()
|
||||
return [r["name"] for r in rows]
|
||||
|
||||
|
||||
def _get_item_collections(
|
||||
zcon: sqlite3.Connection, item_id: int
|
||||
) -> list[str]:
|
||||
"""Read collection keys for a Zotero item."""
|
||||
rows = zcon.execute(
|
||||
"""SELECT c.key FROM collectionItems ci
|
||||
JOIN collections c ON ci.collectionID = c.collectionID
|
||||
WHERE ci.itemID = ?""",
|
||||
(item_id,),
|
||||
).fetchall()
|
||||
return [r["key"] for r in rows]
|
||||
|
||||
|
||||
def _get_item_creators(
|
||||
zcon: sqlite3.Connection, item_id: int
|
||||
) -> list[dict]:
|
||||
"""Read creators for a Zotero item."""
|
||||
rows = zcon.execute(
|
||||
"""SELECT c.firstName, c.lastName, ct.creatorType,
|
||||
ic.orderIndex
|
||||
FROM itemCreators ic
|
||||
JOIN creators c ON ic.creatorID = c.creatorID
|
||||
JOIN creatorTypes ct ON ic.creatorTypeID = ct.creatorTypeID
|
||||
WHERE ic.itemID = ?
|
||||
ORDER BY ic.orderIndex""",
|
||||
(item_id,),
|
||||
).fetchall()
|
||||
return [
|
||||
{
|
||||
"first_name": r["firstName"] or "",
|
||||
"last_name": r["lastName"] or "",
|
||||
"role": r["creatorType"] or "author",
|
||||
"sort_order": r["orderIndex"],
|
||||
}
|
||||
for r in rows
|
||||
]
|
||||
|
||||
|
||||
def _classify_item(
|
||||
zotero_type: str, fields: dict
|
||||
) -> str:
|
||||
"""Map Zotero itemType + fields to bib item_type."""
|
||||
if zotero_type == "statute":
|
||||
code = fields.get("code", "")
|
||||
if "C.F.R." in code:
|
||||
return "regulation"
|
||||
return "rule"
|
||||
if zotero_type == "report":
|
||||
return "manual"
|
||||
if zotero_type == "webpage":
|
||||
return "download"
|
||||
if zotero_type == "document":
|
||||
return "source"
|
||||
# Fallback
|
||||
return "source"
|
||||
|
||||
|
||||
def _build_extra_json(item_type: str, fields: dict) -> str:
|
||||
"""Build the extra_json blob from Zotero fields."""
|
||||
if item_type == "rule":
|
||||
history = fields.get("history", "")
|
||||
doc_num = ""
|
||||
rule_type = ""
|
||||
eff_date = ""
|
||||
for part in history.split("; "):
|
||||
if part.startswith("Document: "):
|
||||
doc_num = part[10:]
|
||||
elif part.startswith("Type: "):
|
||||
rule_type = part[6:]
|
||||
elif part.startswith("Effective: "):
|
||||
eff_date = part[11:]
|
||||
return json.dumps({
|
||||
"fr_volume": fields.get("codeNumber", ""),
|
||||
"fr_page": fields.get("pages", ""),
|
||||
"document_number": doc_num,
|
||||
"cms_id": fields.get("session", ""),
|
||||
"rule_type": rule_type,
|
||||
"effective_date": eff_date,
|
||||
})
|
||||
|
||||
if item_type == "regulation":
|
||||
history = fields.get("history", "")
|
||||
part = ""
|
||||
authority = ""
|
||||
for segment in history.split("; "):
|
||||
if segment.startswith("Part "):
|
||||
part = segment[5:]
|
||||
elif segment.startswith("Authority: "):
|
||||
authority = segment[11:]
|
||||
return json.dumps({
|
||||
"cfr_title": fields.get("codeNumber", ""),
|
||||
"cfr_part": part,
|
||||
"cfr_section": fields.get("section", ""),
|
||||
"authority": authority,
|
||||
"effective_date": fields.get("dateEnacted", ""),
|
||||
})
|
||||
|
||||
if item_type == "manual":
|
||||
extra = fields.get("extra", "")
|
||||
transmittal = ""
|
||||
for line in extra.split("\n"):
|
||||
if line.startswith("Transmittal: "):
|
||||
transmittal = line[13:]
|
||||
chapter = fields.get("seriesNumber", "")
|
||||
if chapter.startswith("Chapter "):
|
||||
chapter = chapter[8:]
|
||||
return json.dumps({
|
||||
"manual_name": fields.get("seriesTitle", ""),
|
||||
"pub_number": fields.get("reportNumber", ""),
|
||||
"chapter": chapter,
|
||||
"transmittal": transmittal,
|
||||
})
|
||||
|
||||
if item_type == "download":
|
||||
extra = fields.get("extra", "")
|
||||
file_urls: list[str] = []
|
||||
for line in extra.split("\n"):
|
||||
if line.startswith("Files: "):
|
||||
file_urls = [
|
||||
u.strip() for u in line[7:].split(";") if u.strip()
|
||||
]
|
||||
return json.dumps({
|
||||
"page_type": "",
|
||||
"file_urls": file_urls,
|
||||
"year": None,
|
||||
"quarter": "",
|
||||
"website_title": fields.get("websiteTitle", ""),
|
||||
})
|
||||
|
||||
if item_type == "source":
|
||||
return json.dumps({
|
||||
"doc_type": fields.get("type", ""),
|
||||
})
|
||||
|
||||
return "{}"
|
||||
|
||||
|
||||
def _get_title(item_type: str, fields: dict) -> str:
|
||||
"""Extract the title field (differs by Zotero itemType)."""
|
||||
if item_type in ("rule", "regulation"):
|
||||
return fields.get("nameOfAct", "")
|
||||
return fields.get("title", "")
|
||||
|
||||
|
||||
def _get_date(item_type: str, fields: dict) -> str:
|
||||
"""Extract the publication date."""
|
||||
if item_type in ("rule", "regulation"):
|
||||
return fields.get("dateEnacted", "")
|
||||
return fields.get("date", "")
|
||||
|
||||
|
||||
def migrate(src: str, dst: str) -> dict[str, int]:
|
||||
"""Run the migration. Returns count summary."""
|
||||
zcon = _read_zotero(src)
|
||||
store = Store(dst)
|
||||
bcon = store._con()
|
||||
|
||||
counts = {
|
||||
"items": 0,
|
||||
"tags": 0,
|
||||
"collections": 0,
|
||||
"attachments": 0,
|
||||
"notes": 0,
|
||||
"creators": 0,
|
||||
"skipped": 0,
|
||||
}
|
||||
|
||||
# ── 1. Collections ───────────────────────────────────────
|
||||
# Build a mapping of Zotero collectionID → bib collection id
|
||||
zot_collections = zcon.execute(
|
||||
"""SELECT collectionID, collectionName, key, parentCollectionID
|
||||
FROM collections WHERE libraryID = 1
|
||||
ORDER BY parentCollectionID NULLS FIRST, collectionName"""
|
||||
).fetchall()
|
||||
|
||||
zot_col_id_to_key: dict[int, str] = {}
|
||||
for zc in zot_collections:
|
||||
zot_col_id_to_key[zc["collectionID"]] = zc["key"]
|
||||
|
||||
for zc in zot_collections:
|
||||
parent_id = None
|
||||
if zc["parentCollectionID"]:
|
||||
parent_key = zot_col_id_to_key.get(zc["parentCollectionID"])
|
||||
if parent_key:
|
||||
row = bcon.execute(
|
||||
"SELECT id FROM collections WHERE key = ?",
|
||||
(parent_key,),
|
||||
).fetchone()
|
||||
if row:
|
||||
parent_id = row["id"]
|
||||
|
||||
bcon.execute(
|
||||
"INSERT OR IGNORE INTO collections (key, name, parent_id) "
|
||||
"VALUES (?, ?, ?)",
|
||||
(zc["key"], zc["collectionName"], parent_id),
|
||||
)
|
||||
counts["collections"] += 1
|
||||
|
||||
bcon.commit()
|
||||
|
||||
# ── 2. Content items ─────────────────────────────────────
|
||||
content_items = zcon.execute(
|
||||
"""SELECT i.itemID, i.key, it.typeName
|
||||
FROM items i
|
||||
JOIN itemTypes it ON i.itemTypeID = it.itemTypeID
|
||||
WHERE i.libraryID = 1
|
||||
AND i.itemID NOT IN (SELECT itemID FROM deletedItems)
|
||||
AND it.typeName NOT IN ('attachment', 'note')
|
||||
ORDER BY i.itemID"""
|
||||
).fetchall()
|
||||
|
||||
for zi in content_items:
|
||||
fields = _get_item_fields(zcon, zi["itemID"])
|
||||
zot_type = zi["typeName"]
|
||||
|
||||
item_type = _classify_item(zot_type, fields)
|
||||
title = _get_title(item_type, fields)
|
||||
date_pub = _get_date(item_type, fields)
|
||||
url = fields.get("url", "")
|
||||
access_date = fields.get("accessDate", "")
|
||||
abstract = fields.get("abstractNote", "")
|
||||
institution = fields.get("institution", "") or fields.get("publisher", "")
|
||||
extra = fields.get("extra", "")
|
||||
extra_json = _build_extra_json(item_type, fields)
|
||||
|
||||
bcon.execute(
|
||||
"""INSERT OR IGNORE INTO items
|
||||
(key, item_type, title, url, date_published,
|
||||
access_date, abstract, institution, extra, extra_json)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
|
||||
(
|
||||
zi["key"],
|
||||
item_type,
|
||||
title,
|
||||
url,
|
||||
date_pub,
|
||||
access_date,
|
||||
abstract,
|
||||
institution,
|
||||
extra,
|
||||
extra_json,
|
||||
),
|
||||
)
|
||||
|
||||
bib_item = bcon.execute(
|
||||
"SELECT id FROM items WHERE key = ?", (zi["key"],)
|
||||
).fetchone()
|
||||
if bib_item is None:
|
||||
counts["skipped"] += 1
|
||||
continue
|
||||
|
||||
bib_id = bib_item["id"]
|
||||
counts["items"] += 1
|
||||
|
||||
# Tags
|
||||
ztags = _get_item_tags(zcon, zi["itemID"])
|
||||
for tag_name in ztags:
|
||||
tag_id = store._ensure_tag(tag_name)
|
||||
bcon.execute(
|
||||
"INSERT OR IGNORE INTO item_tags (item_id, tag_id) "
|
||||
"VALUES (?, ?)",
|
||||
(bib_id, tag_id),
|
||||
)
|
||||
counts["tags"] += 1
|
||||
|
||||
# Collections
|
||||
zcols = _get_item_collections(zcon, zi["itemID"])
|
||||
for ckey in zcols:
|
||||
crow = bcon.execute(
|
||||
"SELECT id FROM collections WHERE key = ?", (ckey,)
|
||||
).fetchone()
|
||||
if crow:
|
||||
bcon.execute(
|
||||
"INSERT OR IGNORE INTO collection_items "
|
||||
"(collection_id, item_id) VALUES (?, ?)",
|
||||
(crow["id"], bib_id),
|
||||
)
|
||||
|
||||
# Creators
|
||||
creators = _get_item_creators(zcon, zi["itemID"])
|
||||
for cr in creators:
|
||||
# Find or create creator
|
||||
crow = bcon.execute(
|
||||
"SELECT id FROM creators "
|
||||
"WHERE first_name = ? AND last_name = ?",
|
||||
(cr["first_name"], cr["last_name"]),
|
||||
).fetchone()
|
||||
if crow:
|
||||
creator_id = crow["id"]
|
||||
else:
|
||||
cur = bcon.execute(
|
||||
"INSERT INTO creators (first_name, last_name) "
|
||||
"VALUES (?, ?)",
|
||||
(cr["first_name"], cr["last_name"]),
|
||||
)
|
||||
creator_id = cur.lastrowid
|
||||
counts["creators"] += 1
|
||||
|
||||
bcon.execute(
|
||||
"INSERT OR IGNORE INTO item_creators "
|
||||
"(item_id, creator_id, role, sort_order) "
|
||||
"VALUES (?, ?, ?, ?)",
|
||||
(bib_id, creator_id, cr["role"], cr["sort_order"]),
|
||||
)
|
||||
|
||||
bcon.commit()
|
||||
|
||||
# ── 3. Attachments ───────────────────────────────────────
|
||||
zot_attachments = zcon.execute(
|
||||
"""SELECT ia.itemID, ia.parentItemID, ia.path,
|
||||
ia.contentType, i.key
|
||||
FROM itemAttachments ia
|
||||
JOIN items i ON ia.itemID = i.itemID
|
||||
WHERE i.libraryID = 1
|
||||
AND ia.parentItemID IS NOT NULL
|
||||
AND i.itemID NOT IN (SELECT itemID FROM deletedItems)"""
|
||||
).fetchall()
|
||||
|
||||
for za in zot_attachments:
|
||||
# Find parent in bib
|
||||
parent_row = zcon.execute(
|
||||
"SELECT key FROM items WHERE itemID = ?",
|
||||
(za["parentItemID"],),
|
||||
).fetchone()
|
||||
if parent_row is None:
|
||||
continue
|
||||
|
||||
bib_parent = bcon.execute(
|
||||
"SELECT id FROM items WHERE key = ?", (parent_row["key"],)
|
||||
).fetchone()
|
||||
if bib_parent is None:
|
||||
continue
|
||||
|
||||
# Extract filename from Zotero storage path
|
||||
zpath = za["path"] or ""
|
||||
filename = zpath.replace("storage:", "") if zpath else za["key"]
|
||||
|
||||
bcon.execute(
|
||||
"""INSERT OR IGNORE INTO attachments
|
||||
(item_id, key, filename, content_type, storage_path)
|
||||
VALUES (?, ?, ?, ?, ?)""",
|
||||
(
|
||||
bib_parent["id"],
|
||||
za["key"],
|
||||
filename,
|
||||
za["contentType"] or "",
|
||||
zpath,
|
||||
),
|
||||
)
|
||||
counts["attachments"] += 1
|
||||
|
||||
bcon.commit()
|
||||
|
||||
# ── 4. Notes ─────────────────────────────────────────────
|
||||
zot_notes = zcon.execute(
|
||||
"""SELECT inote.itemID, inote.parentItemID, inote.note,
|
||||
inote.title, i.key
|
||||
FROM itemNotes inote
|
||||
JOIN items i ON inote.itemID = i.itemID
|
||||
WHERE i.libraryID = 1
|
||||
AND inote.parentItemID IS NOT NULL
|
||||
AND i.itemID NOT IN (SELECT itemID FROM deletedItems)"""
|
||||
).fetchall()
|
||||
|
||||
for zn in zot_notes:
|
||||
parent_row = zcon.execute(
|
||||
"SELECT key FROM items WHERE itemID = ?",
|
||||
(zn["parentItemID"],),
|
||||
).fetchone()
|
||||
if parent_row is None:
|
||||
continue
|
||||
|
||||
bib_parent = bcon.execute(
|
||||
"SELECT id FROM items WHERE key = ?", (parent_row["key"],)
|
||||
).fetchone()
|
||||
if bib_parent is None:
|
||||
continue
|
||||
|
||||
bcon.execute(
|
||||
"INSERT INTO notes (item_id, title, content) VALUES (?, ?, ?)",
|
||||
(bib_parent["id"], zn["title"] or "", zn["note"] or ""),
|
||||
)
|
||||
counts["notes"] += 1
|
||||
|
||||
bcon.commit()
|
||||
|
||||
# ── 5. Metadata ──────────────────────────────────────────
|
||||
bcon.execute(
|
||||
"INSERT OR REPLACE INTO bib_meta (key, value) VALUES (?, ?)",
|
||||
("migrated_from", src),
|
||||
)
|
||||
bcon.commit()
|
||||
|
||||
zcon.close()
|
||||
store.close()
|
||||
return counts
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Migrate Zotero SQLite to bib SQLite"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--src",
|
||||
default="zotero/data/zotero.sqlite",
|
||||
help="Path to Zotero SQLite database",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--dst",
|
||||
default="data/bib.sqlite",
|
||||
help="Path to output bib SQLite database",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
# Ensure destination directory exists
|
||||
Path(args.dst).parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
print(f"Migrating: {args.src} → {args.dst}")
|
||||
counts = migrate(args.src, args.dst)
|
||||
|
||||
print("Migration complete:")
|
||||
for k, v in counts.items():
|
||||
print(f" {k}: {v}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
BIN
dev/unmapped-fields-between-cclf-and-bcda.xlsx
Normal file
BIN
dev/unmapped-fields-between-cclf-and-bcda.xlsx
Normal file
Binary file not shown.
733
notebooks/bib_explorer.py
Normal file
733
notebooks/bib_explorer.py
Normal file
@@ -0,0 +1,733 @@
|
||||
import marimo
|
||||
|
||||
__generated_with = "0.19.9"
|
||||
app = marimo.App(width="medium")
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _():
|
||||
import marimo as mo
|
||||
|
||||
mo.md("""
|
||||
# Bibliography Explorer
|
||||
|
||||
Browse, search, and cite from the **bib** reference library — a denormalized SQLite store
|
||||
that replaces Zotero's 61-table schema with 8 clean tables.
|
||||
|
||||
This notebook provides:
|
||||
|
||||
1. **Migration** — one-click import from the Zotero container database
|
||||
2. **Library overview** — stats, collections, tags
|
||||
3. **Browse & search** — filter by type, tag, collection, or free text
|
||||
4. **Item inspector** — full metadata for any item
|
||||
5. **Citations** — APA and Bluebook formatted references
|
||||
6. **DataFrame export** — polars DataFrame for downstream analysis
|
||||
""")
|
||||
return (mo,)
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
from pathlib import Path
|
||||
|
||||
from bib.client import COLLECTIONS
|
||||
from bib.format import format_bibliography, format_citation
|
||||
from bib.item import Download, Item, Manual, Regulation, Rule, Source
|
||||
from bib.store import Store
|
||||
from bib.tag import Tag, filter_tags
|
||||
|
||||
BIB_DB = Path("/home/kert/data/bib.sqlite")
|
||||
ZOTERO_DB = Path("/home/kert/zotero/zotero.sqlite")
|
||||
|
||||
store = Store(str(BIB_DB))
|
||||
|
||||
mo.md(f"""
|
||||
## 1. Connect
|
||||
|
||||
| Setting | Value |
|
||||
|---------|-------|
|
||||
| Database | `{BIB_DB}` |
|
||||
| Exists | **{BIB_DB.exists()}** |
|
||||
| Zotero source | `{ZOTERO_DB}` |
|
||||
| Zotero available | **{ZOTERO_DB.exists()}** |
|
||||
""")
|
||||
return (
|
||||
COLLECTIONS,
|
||||
Download,
|
||||
Manual,
|
||||
Regulation,
|
||||
Rule,
|
||||
Source,
|
||||
Tag,
|
||||
ZOTERO_DB,
|
||||
format_citation,
|
||||
store,
|
||||
)
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(ZOTERO_DB, mo, store):
|
||||
_item_count = store._con().execute("SELECT COUNT(*) FROM items").fetchone()[0]
|
||||
|
||||
if _item_count > 0:
|
||||
mo.md(f"""
|
||||
## 2. Migration
|
||||
|
||||
Database already has **{_item_count}** items — migration not needed.
|
||||
|
||||
To re-migrate, delete `data/bib.sqlite` and restart.
|
||||
""")
|
||||
elif not ZOTERO_DB.exists():
|
||||
mo.md("""
|
||||
## 2. Migration
|
||||
|
||||
No Zotero database found at `/home/kert/zotero/zotero.sqlite`.
|
||||
Start the Zotero container first, or add items manually below.
|
||||
""")
|
||||
else:
|
||||
mo.md("""
|
||||
## 2. Migration
|
||||
|
||||
Database is empty and Zotero source is available. Click **Migrate** to import.
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(ZOTERO_DB, mo, store):
|
||||
_count = store._con().execute("SELECT COUNT(*) FROM items").fetchone()[0]
|
||||
_show_migrate = _count == 0 and ZOTERO_DB.exists()
|
||||
|
||||
migrate_btn = mo.ui.run_button(label="Migrate from Zotero") if _show_migrate else None
|
||||
migrate_btn
|
||||
return (migrate_btn,)
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(ZOTERO_DB, migrate_btn, mo, store):
|
||||
if migrate_btn is None or not migrate_btn.value:
|
||||
mo.stop(True)
|
||||
|
||||
# Inline migration — reads Zotero EAV, writes to the bib store
|
||||
import sqlite3
|
||||
|
||||
zcon = sqlite3.connect(f"file:{ZOTERO_DB}?mode=ro", uri=True)
|
||||
zcon.row_factory = sqlite3.Row
|
||||
|
||||
# Migrate collections
|
||||
_zot_cols = zcon.execute(
|
||||
"""SELECT collectionID, collectionName, key, parentCollectionID
|
||||
FROM collections WHERE libraryID = 1
|
||||
ORDER BY parentCollectionID NULLS FIRST"""
|
||||
).fetchall()
|
||||
_col_id_to_key = {r["collectionID"]: r["key"] for r in _zot_cols}
|
||||
bcon = store._con()
|
||||
for _zc in _zot_cols:
|
||||
_pid = None
|
||||
if _zc["parentCollectionID"]:
|
||||
_pk = _col_id_to_key.get(_zc["parentCollectionID"])
|
||||
if _pk:
|
||||
_pr = bcon.execute("SELECT id FROM collections WHERE key = ?", (_pk,)).fetchone()
|
||||
if _pr:
|
||||
_pid = _pr["id"]
|
||||
bcon.execute(
|
||||
"INSERT OR IGNORE INTO collections (key, name, parent_id) VALUES (?, ?, ?)",
|
||||
(_zc["key"], _zc["collectionName"], _pid),
|
||||
)
|
||||
bcon.commit()
|
||||
|
||||
# Migrate content items
|
||||
_content = zcon.execute(
|
||||
"""SELECT i.itemID, i.key, it.typeName
|
||||
FROM items i JOIN itemTypes it ON i.itemTypeID = it.itemTypeID
|
||||
WHERE i.libraryID = 1
|
||||
AND i.itemID NOT IN (SELECT itemID FROM deletedItems)
|
||||
AND it.typeName NOT IN ('attachment', 'note')
|
||||
ORDER BY i.itemID"""
|
||||
).fetchall()
|
||||
|
||||
_migrated = 0
|
||||
for _zi in _content:
|
||||
# Read fields via EAV join
|
||||
_fields = {
|
||||
r["fieldName"]: r["value"]
|
||||
for r in zcon.execute(
|
||||
"""SELECT f.fieldName, idv.value FROM itemData id
|
||||
JOIN fields f ON id.fieldID = f.fieldID
|
||||
JOIN itemDataValues idv ON id.valueID = idv.valueID
|
||||
WHERE id.itemID = ?""",
|
||||
(_zi["itemID"],),
|
||||
).fetchall()
|
||||
}
|
||||
|
||||
# Classify
|
||||
_zt = _zi["typeName"]
|
||||
if _zt == "statute":
|
||||
_it = "regulation" if "C.F.R." in _fields.get("code", "") else "rule"
|
||||
elif _zt == "report":
|
||||
_it = "manual"
|
||||
elif _zt == "webpage":
|
||||
_it = "download"
|
||||
else:
|
||||
_it = "source"
|
||||
|
||||
# Title
|
||||
_title = _fields.get("nameOfAct", "") if _it in ("rule", "regulation") else _fields.get("title", "")
|
||||
_date = _fields.get("dateEnacted", "") if _it in ("rule", "regulation") else _fields.get("date", "")
|
||||
|
||||
bcon.execute(
|
||||
"""INSERT OR IGNORE INTO items
|
||||
(key, item_type, title, url, date_published, access_date, abstract, institution, extra, extra_json)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
|
||||
(
|
||||
_zi["key"], _it, _title,
|
||||
_fields.get("url", ""), _date,
|
||||
_fields.get("accessDate", ""), _fields.get("abstractNote", ""),
|
||||
_fields.get("institution", "") or _fields.get("publisher", ""),
|
||||
_fields.get("extra", ""), "{}",
|
||||
),
|
||||
)
|
||||
|
||||
_bib_row = bcon.execute("SELECT id FROM items WHERE key = ?", (_zi["key"],)).fetchone()
|
||||
if _bib_row is None:
|
||||
continue
|
||||
_bid = _bib_row["id"]
|
||||
_migrated += 1
|
||||
|
||||
# Tags
|
||||
for _tr in zcon.execute(
|
||||
"SELECT t.name FROM itemTags it JOIN tags t ON it.tagID = t.tagID WHERE it.itemID = ?",
|
||||
(_zi["itemID"],),
|
||||
).fetchall():
|
||||
_tid = store._ensure_tag(_tr["name"])
|
||||
bcon.execute("INSERT OR IGNORE INTO item_tags (item_id, tag_id) VALUES (?, ?)", (_bid, _tid))
|
||||
|
||||
# Collection membership
|
||||
for _cr in zcon.execute(
|
||||
"SELECT c.key FROM collectionItems ci JOIN collections c ON ci.collectionID = c.collectionID WHERE ci.itemID = ?",
|
||||
(_zi["itemID"],),
|
||||
).fetchall():
|
||||
_cid_row = bcon.execute("SELECT id FROM collections WHERE key = ?", (_cr["key"],)).fetchone()
|
||||
if _cid_row:
|
||||
bcon.execute(
|
||||
"INSERT OR IGNORE INTO collection_items (collection_id, item_id) VALUES (?, ?)",
|
||||
(_cid_row["id"], _bid),
|
||||
)
|
||||
|
||||
bcon.commit()
|
||||
zcon.close()
|
||||
|
||||
mo.md(f"Migrated **{_migrated}** items from Zotero.")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(COLLECTIONS, mo, store):
|
||||
_cols = store.ensure_collections(COLLECTIONS)
|
||||
mo.md(f"Ensured **{len(_cols)}** collections.")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
mo.md("""
|
||||
## 3. Library Overview
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo, store):
|
||||
_con = store._con()
|
||||
|
||||
_stats = {}
|
||||
_stats["Items"] = _con.execute("SELECT COUNT(*) FROM items").fetchone()[0]
|
||||
_stats["Collections"] = _con.execute("SELECT COUNT(*) FROM collections").fetchone()[0]
|
||||
_stats["Tags"] = _con.execute("SELECT COUNT(*) FROM tags").fetchone()[0]
|
||||
_stats["Creators"] = _con.execute("SELECT COUNT(*) FROM creators").fetchone()[0]
|
||||
_stats["Attachments"] = _con.execute("SELECT COUNT(*) FROM attachments").fetchone()[0]
|
||||
_stats["Notes"] = _con.execute("SELECT COUNT(*) FROM notes").fetchone()[0]
|
||||
|
||||
_stat_table = "\n".join(f"| {k} | {v:,} |" for k, v in _stats.items())
|
||||
mo.md(f"""
|
||||
| Metric | Count |
|
||||
|--------|-------|
|
||||
{_stat_table}
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
mo.md("""
|
||||
### Item Types
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo, store):
|
||||
import polars as pl
|
||||
|
||||
_types_rows = store._con().execute(
|
||||
"""SELECT item_type, COUNT(*) as count
|
||||
FROM items GROUP BY item_type ORDER BY count DESC"""
|
||||
).fetchall()
|
||||
_types_df = pl.DataFrame([dict(r) for r in _types_rows]) if _types_rows else pl.DataFrame()
|
||||
|
||||
mo.ui.table(_types_df, label="Item Types") if _types_df.height > 0 else mo.md("No items yet.")
|
||||
return (pl,)
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
mo.md("""
|
||||
### Collections
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo, store):
|
||||
_collections = store.list_collections()
|
||||
|
||||
# Build a tree from the flat list
|
||||
_by_key = {c["key"]: c for c in _collections}
|
||||
_children: dict[str, list] = {}
|
||||
_roots = []
|
||||
for _c in _collections:
|
||||
pk = _c["parent_key"]
|
||||
if pk:
|
||||
_children.setdefault(pk, []).append(_c)
|
||||
else:
|
||||
_roots.append(_c)
|
||||
|
||||
# Build tree iteratively (recursive local fns break in marimo cells)
|
||||
_tree_lines = []
|
||||
_stack = [(n, 0) for n in sorted(_roots, key=lambda x: x["name"], reverse=True)]
|
||||
while _stack:
|
||||
_node, _depth = _stack.pop()
|
||||
_tree_lines.append(f"{' ' * _depth}- **{_node['name']}** ({_node['item_count']} items)")
|
||||
for _ch in sorted(_children.get(_node["key"], []), key=lambda x: x["name"], reverse=True):
|
||||
_stack.append((_ch, _depth + 1))
|
||||
mo.md("\n".join(_tree_lines) if _tree_lines else "No collections. Ensure collections above.")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
mo.md("""
|
||||
### Tags
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo, pl, store):
|
||||
_tag_list = store.list_tags()
|
||||
_tag_df = pl.DataFrame(_tag_list) if _tag_list else pl.DataFrame()
|
||||
|
||||
mo.ui.table(_tag_df, label="Tags") if _tag_df.height > 0 else mo.md("No tags yet.")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
mo.md("""
|
||||
## 4. Browse & Search
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo, store):
|
||||
_type_opts = [""] + sorted({
|
||||
r[0] for r in store._con().execute(
|
||||
"SELECT DISTINCT item_type FROM items"
|
||||
).fetchall()
|
||||
})
|
||||
_tag_opts = [""] + [
|
||||
t["name"] for t in store.list_tags()
|
||||
]
|
||||
_col_opts = [""] + [
|
||||
f"{c['name']}|{c['key']}" for c in store.list_collections()
|
||||
]
|
||||
|
||||
search_input = mo.ui.text(placeholder="Search titles and abstracts...", label="Search", full_width=True)
|
||||
type_filter = mo.ui.dropdown(options=_type_opts, value="", label="Type")
|
||||
tag_filter = mo.ui.dropdown(options=_tag_opts, value="", label="Tag")
|
||||
col_filter = mo.ui.dropdown(options=_col_opts, value="", label="Collection")
|
||||
|
||||
mo.hstack([search_input], widths=[1])
|
||||
mo.hstack([type_filter, tag_filter, col_filter], widths=[1, 1, 1])
|
||||
return col_filter, search_input, tag_filter, type_filter
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(col_filter, mo, pl, search_input, store, tag_filter, type_filter):
|
||||
_filters = {}
|
||||
if search_input.value:
|
||||
_filters["query"] = search_input.value.strip()
|
||||
if type_filter.value:
|
||||
_filters["item_type"] = type_filter.value
|
||||
if tag_filter.value:
|
||||
_filters["tag"] = tag_filter.value
|
||||
if col_filter.value and "|" in col_filter.value:
|
||||
_filters["collection"] = col_filter.value.split("|")[1]
|
||||
|
||||
_items = store.list_items(**_filters)
|
||||
|
||||
_rows = [
|
||||
{
|
||||
"key": it.key,
|
||||
"type": it.item_type,
|
||||
"title": it.title[:100],
|
||||
"date": it.date_published,
|
||||
"tags": "; ".join(it.tags[:4]),
|
||||
"url": it.url[:60] if it.url else "",
|
||||
}
|
||||
for it in _items
|
||||
]
|
||||
_browse_df = pl.DataFrame(_rows) if _rows else pl.DataFrame()
|
||||
|
||||
_label = f"Items ({len(_items)} total)"
|
||||
if _browse_df.height > 0:
|
||||
items_table = mo.ui.table(_browse_df, selection="single", label=_label)
|
||||
else:
|
||||
items_table = None
|
||||
mo.output.replace(mo.md("No items match the current filters."))
|
||||
return (items_table,)
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
mo.md("""
|
||||
## 5. Item Inspector
|
||||
|
||||
Select a row above, or enter a key below.
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(items_table, mo):
|
||||
_default_key = ""
|
||||
if items_table is not None:
|
||||
_val = items_table.value
|
||||
import polars as _pl
|
||||
if isinstance(_val, _pl.DataFrame) and _val.height > 0:
|
||||
_default_key = _val["key"][0]
|
||||
elif isinstance(_val, list) and len(_val) > 0:
|
||||
_default_key = _val[0].get("key", "") if isinstance(_val[0], dict) else ""
|
||||
|
||||
key_input = mo.ui.text(value=_default_key, label="Item Key", full_width=False)
|
||||
key_input
|
||||
return (key_input,)
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(format_citation, key_input, mo, store):
|
||||
_key = key_input.value.strip() if key_input.value else ""
|
||||
|
||||
if not _key:
|
||||
mo.md("Enter an item key above.")
|
||||
mo.stop(True)
|
||||
|
||||
try:
|
||||
_item = store.get(_key)
|
||||
except KeyError:
|
||||
mo.md(f"Item **{_key}** not found.")
|
||||
mo.stop(True)
|
||||
|
||||
_sections = [f"### {_item.title}\n"]
|
||||
|
||||
# Metadata table
|
||||
_sections.append("| Field | Value |")
|
||||
_sections.append("|-------|-------|")
|
||||
_sections.append(f"| Key | `{_item.key}` |")
|
||||
_sections.append(f"| Type | {_item.item_type} |")
|
||||
if _item.date_published:
|
||||
_sections.append(f"| Published | {_item.date_published} |")
|
||||
if _item.institution:
|
||||
_sections.append(f"| Institution | {_item.institution} |")
|
||||
if _item.url:
|
||||
_sections.append(f"| URL | {_item.url[:80]} |")
|
||||
if _item.access_date:
|
||||
_sections.append(f"| Accessed | {_item.access_date} |")
|
||||
|
||||
# Type-specific fields from extra_json
|
||||
import json as _json
|
||||
|
||||
_row = _item.to_row()
|
||||
_ej = _json.loads(_row.get("extra_json", "{}"))
|
||||
for _field, _val in _ej.items():
|
||||
if _val:
|
||||
_sections.append(f"| {_field} | {str(_val)[:80]} |")
|
||||
|
||||
# Tags
|
||||
if _item.tags:
|
||||
_sections.append(f"\n**Tags**: {', '.join(f'`{t}`' for t in _item.tags)}")
|
||||
|
||||
# Abstract
|
||||
if _item.abstract:
|
||||
_sections.append(f"\n**Abstract**: {_item.abstract[:300]}{'...' if len(_item.abstract) > 300 else ''}")
|
||||
|
||||
# Citation preview
|
||||
_cite_apa = format_citation(_item, style="apa")
|
||||
_sections.append(f"\n**APA Citation**:\n> {_cite_apa}")
|
||||
|
||||
if _item.item_type == "regulation":
|
||||
_cite_bb = format_citation(_item, style="bluebook")
|
||||
_sections.append(f"\n**Bluebook Citation**:\n> {_cite_bb}")
|
||||
|
||||
# Attachments
|
||||
_atts = store._con().execute(
|
||||
"""SELECT key, filename, content_type FROM attachments
|
||||
WHERE item_id = (SELECT id FROM items WHERE key = ?)""",
|
||||
(_key,),
|
||||
).fetchall()
|
||||
if _atts:
|
||||
_sections.append("\n**Attachments**")
|
||||
for _a in _atts:
|
||||
_sections.append(f"- `{_a['filename']}` ({_a['content_type'] or 'unknown'})")
|
||||
|
||||
# Notes
|
||||
_notes = store._con().execute(
|
||||
"""SELECT title, content FROM notes
|
||||
WHERE item_id = (SELECT id FROM items WHERE key = ?)""",
|
||||
(_key,),
|
||||
).fetchall()
|
||||
if _notes:
|
||||
_sections.append("\n**Notes**")
|
||||
for _n in _notes:
|
||||
_title = _n["title"] or "(untitled)"
|
||||
_content = _n["content"][:200] if _n["content"] else ""
|
||||
_sections.append(f"- **{_title}**: {_content}")
|
||||
|
||||
mo.md("\n".join(_sections))
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
mo.md("""
|
||||
## 6. Create an Item
|
||||
|
||||
Add a new citation manually using one of the five item types.
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
new_type = mo.ui.dropdown(
|
||||
options=["rule", "manual", "regulation", "download", "source"],
|
||||
value="rule",
|
||||
label="Item Type",
|
||||
)
|
||||
new_title = mo.ui.text(placeholder="Title", label="Title", full_width=True)
|
||||
new_url = mo.ui.text(placeholder="URL", label="URL", full_width=True)
|
||||
new_tags_input = mo.ui.text(placeholder="module:pfs, year:2026", label="Tags (comma-separated)", full_width=True)
|
||||
create_btn = mo.ui.run_button(label="Create Item")
|
||||
|
||||
mo.vstack([
|
||||
mo.hstack([new_type, new_title], widths=[1, 3]),
|
||||
new_url,
|
||||
mo.hstack([new_tags_input, create_btn], widths=[3, 1]),
|
||||
])
|
||||
return create_btn, new_tags_input, new_title, new_type, new_url
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(
|
||||
Download,
|
||||
Manual,
|
||||
Regulation,
|
||||
Rule,
|
||||
Source,
|
||||
Tag,
|
||||
create_btn,
|
||||
mo,
|
||||
new_tags_input,
|
||||
new_title,
|
||||
new_type,
|
||||
new_url,
|
||||
store,
|
||||
):
|
||||
if not create_btn.value:
|
||||
mo.stop(True)
|
||||
|
||||
_title = new_title.value.strip() if new_title.value else ""
|
||||
if not _title:
|
||||
mo.md("Enter a title.")
|
||||
mo.stop(True)
|
||||
|
||||
_type_map = {
|
||||
"rule": Rule,
|
||||
"manual": Manual,
|
||||
"regulation": Regulation,
|
||||
"download": Download,
|
||||
"source": Source,
|
||||
}
|
||||
_cls = _type_map[new_type.value]
|
||||
_item = _cls(title=_title, url=new_url.value.strip() if new_url.value else "")
|
||||
|
||||
# Parse tags
|
||||
_tags = []
|
||||
if new_tags_input.value:
|
||||
for _t in new_tags_input.value.split(","):
|
||||
_t = _t.strip()
|
||||
if ":" in _t:
|
||||
_tags.append(Tag.from_label(_t))
|
||||
|
||||
_key = store.upsert(_item, tags=_tags)
|
||||
mo.md(f"Created item `{_key}`: **{_title}**")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
mo.md("""
|
||||
## 7. Use a Translator
|
||||
|
||||
Fetch and parse a CMS source page directly into a citation.
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
translator_type = mo.ui.dropdown(
|
||||
options=["cms_manual", "cms_website", "ecfr"],
|
||||
value="cms_manual",
|
||||
label="Translator",
|
||||
)
|
||||
translator_url = mo.ui.text(
|
||||
placeholder="https://www.cms.gov/...",
|
||||
label="URL",
|
||||
full_width=True,
|
||||
)
|
||||
translate_btn = mo.ui.run_button(label="Translate & Save")
|
||||
|
||||
mo.hstack([translator_type, translator_url, translate_btn], widths=[1, 3, 1])
|
||||
return translate_btn, translator_type, translator_url
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(
|
||||
format_citation,
|
||||
mo,
|
||||
store,
|
||||
translate_btn,
|
||||
translator_type,
|
||||
translator_url,
|
||||
):
|
||||
if not translate_btn.value:
|
||||
mo.stop(True)
|
||||
|
||||
_url = translator_url.value.strip() if translator_url.value else ""
|
||||
if not _url:
|
||||
mo.md("Enter a URL to translate.")
|
||||
mo.stop(True)
|
||||
|
||||
from bib import translate
|
||||
|
||||
_translators = {
|
||||
"cms_manual": translate.cms_manual,
|
||||
"cms_website": translate.cms_website,
|
||||
"ecfr": translate.ecfr,
|
||||
}
|
||||
|
||||
try:
|
||||
_fn = _translators[translator_type.value]
|
||||
_item = _fn(_url)
|
||||
_key = store.upsert(_item)
|
||||
_cite = format_citation(_item, style="apa")
|
||||
mo.md(f"""
|
||||
Saved as `{_key}`: **{_item.title}**
|
||||
|
||||
Tags: {', '.join(f'`{t}`' for t in _item.tags)}
|
||||
|
||||
> {_cite}
|
||||
""")
|
||||
except Exception as e:
|
||||
mo.md(f"Translation failed: `{e}`")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
mo.md("""
|
||||
## 8. Bibliography Generator
|
||||
|
||||
Select items by tag or type to generate a formatted reference list.
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo, store):
|
||||
_bib_tag_opts = [""] + [t["name"] for t in store.list_tags()]
|
||||
_bib_type_opts = [""] + sorted({
|
||||
r[0] for r in store._con().execute(
|
||||
"SELECT DISTINCT item_type FROM items"
|
||||
).fetchall()
|
||||
})
|
||||
|
||||
bib_tag = mo.ui.dropdown(options=_bib_tag_opts, value="", label="Filter by tag")
|
||||
bib_type = mo.ui.dropdown(options=_bib_type_opts, value="", label="Filter by type")
|
||||
bib_style = mo.ui.dropdown(options=["apa", "bluebook"], value="apa", label="Style")
|
||||
|
||||
mo.hstack([bib_tag, bib_type, bib_style], widths=[1, 1, 1])
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
mo.md("""
|
||||
## 9. Export to DataFrame
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo, store):
|
||||
try:
|
||||
library_df = store.to_dataframe()
|
||||
mo.md(f"Exported **{library_df.height}** items to `library_df`")
|
||||
except Exception:
|
||||
library_df = None
|
||||
mo.md("No items to export.")
|
||||
return (library_df,)
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(library_df, mo):
|
||||
if library_df is not None and library_df.height > 0:
|
||||
mo.ui.dataframe(library_df)
|
||||
else:
|
||||
mo.md("DataFrame is empty. Add some items first.")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
mo.md("""
|
||||
## Summary
|
||||
|
||||
| Feature | Details |
|
||||
|---------|---------|
|
||||
| Storage | SQLite, 8 denormalized tables |
|
||||
| Item types | rule, manual, regulation, download, source |
|
||||
| Tags | `namespace:value` (module, source, year, rule, file, table) |
|
||||
| Citations | APA (all types), Bluebook (regulations) |
|
||||
| Translators | Federal Register, CMS Website, CMS Manual, eCFR, 4i |
|
||||
| Source | `src/bib/` (mounted read-only via `PYTHONPATH`) |
|
||||
|
||||
The `bib` module is available at `from bib import connect, Store, Rule, Tag`.
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
||||
@@ -7,6 +7,7 @@ requires-python = ">=3.12"
|
||||
dependencies = [
|
||||
"databricks-cli>=0.18.0",
|
||||
"databricks-sdk>=0.85.0",
|
||||
"fsspec>=2024.1.0",
|
||||
"httpx>=0.28.1",
|
||||
"pyarrow>=23.0.0",
|
||||
"sqlglot>=26.0.0",
|
||||
|
||||
85
src/bcda/__init__.py
Normal file
85
src/bcda/__init__.py
Normal file
@@ -0,0 +1,85 @@
|
||||
"""bcda -- Beneficiary Claims Data API client and table models.
|
||||
|
||||
BCDA is the CMS Beneficiary Claims Data API, a FHIR R4-based
|
||||
alternative to CCLF flat files for ACO claims data access. BCDA
|
||||
delivers Medicare claims and beneficiary data via bulk FHIR ndjson
|
||||
exports.
|
||||
|
||||
The table models represent the **flattened** FHIR R4 payload
|
||||
structure — what you actually get in the ndjson lines — not the
|
||||
CCLF field names.
|
||||
|
||||
Usage::
|
||||
|
||||
from bcda.client import Client
|
||||
|
||||
with Client(client_id="...", client_secret="...") as c:
|
||||
files = c.export(types=["Patient", "ExplanationOfBenefit"])
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
``bcda.client``
|
||||
HTTP client for the BCDA v2 bulk FHIR export API.
|
||||
Handles auth, job management, polling, and ndjson download.
|
||||
|
||||
``bcda.store``
|
||||
Persistent storage and state management. Wraps the client
|
||||
with append-only Parquet state tracking and configurable file
|
||||
storage (local, network, S3, Azure Blob via fsspec).
|
||||
Supports retry / resume of interrupted exports.
|
||||
|
||||
``bcda.log``
|
||||
JSONL structured logging handler. Attaches to the ``bcda``
|
||||
logger hierarchy to capture full operation detail into an
|
||||
append-only ``.jsonl`` file.
|
||||
|
||||
``bcda.express``
|
||||
Narwhals expression functions for transforming BCDA FHIR R4
|
||||
resources into input_layer tables (medical_claim,
|
||||
pharmacy_claim, eligibility).
|
||||
|
||||
``bcda.pipe``
|
||||
Pipeline definitions wiring express functions into executable
|
||||
DAGs via ``aco.pipe.base.Pipeline``.
|
||||
|
||||
``bcda.table``
|
||||
Pydantic ``SQLTable`` models for 8 BCDA data entities:
|
||||
3 adjudicated FHIR R4 resources (Patient, ExplanationOfBenefit,
|
||||
Coverage) plus EobItem for line items, and 4 partially
|
||||
adjudicated tables (FISS/MCS Claim and ClaimResponse).
|
||||
|
||||
Adjudicated Claims — FHIR R4 Resources
|
||||
----------------------------------------
|
||||
|
||||
Delivered via ``/api/v2/{Resource}/$export`` bulk endpoints:
|
||||
|
||||
::
|
||||
|
||||
| Table | Fields | FHIR R4 Resource |
|
||||
|-------------------------|--------|------------------------|
|
||||
| patient | 26 | Patient |
|
||||
| explanation_of_benefit | 79 | ExplanationOfBenefit |
|
||||
| eob_item | 23 | ExplanationOfBenefit |
|
||||
| coverage | 10 | Coverage |
|
||||
|
||||
``ExplanationOfBenefit`` is split into header-level fields
|
||||
(``explanation_of_benefit``) and repeating line items
|
||||
(``eob_item``) since the FHIR resource is hierarchical.
|
||||
|
||||
Partially Adjudicated Claims
|
||||
-----------------------------
|
||||
|
||||
Available via BCDA v2 only. Updated daily (2-4 day lag).
|
||||
Sourced from FISS (institutional) and MCS (professional)
|
||||
processing systems, mapped to FHIR R4 Claim and ClaimResponse:
|
||||
|
||||
::
|
||||
|
||||
| Table | Fields | Source | FHIR Resource |
|
||||
|----------------------|--------|--------|---------------|
|
||||
| fiss_claim | 40 | FISS | Claim |
|
||||
| fiss_claim_response | 14 | FISS | ClaimResponse |
|
||||
| mcs_claim | 28 | MCS | Claim |
|
||||
| mcs_claim_response | 9 | MCS | ClaimResponse |
|
||||
"""
|
||||
BIN
src/bcda/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
src/bcda/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/__pycache__/client.cpython-313.pyc
Normal file
BIN
src/bcda/__pycache__/client.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/__pycache__/log.cpython-313.pyc
Normal file
BIN
src/bcda/__pycache__/log.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/__pycache__/store.cpython-313.pyc
Normal file
BIN
src/bcda/__pycache__/store.cpython-313.pyc
Normal file
Binary file not shown.
588
src/bcda/client.py
Normal file
588
src/bcda/client.py
Normal file
@@ -0,0 +1,588 @@
|
||||
"""BCDA bulk FHIR export client.
|
||||
|
||||
Wraps the CMS Beneficiary Claims Data API v2 four-step flow:
|
||||
|
||||
1. Authenticate (POST ``/auth/token`` with client credentials)
|
||||
2. Start export job (GET ``/api/v2/Group/all/$export``)
|
||||
3. Poll until complete (GET ``/api/v2/jobs/{job_id}``)
|
||||
4. Download ndjson files (GET ``/data/{job_id}/{filename}``)
|
||||
|
||||
Handles token refresh (20-min expiry), exponential backoff on
|
||||
transient errors, 429 rate-limit back-off, and gzip-compressed
|
||||
ndjson downloads.
|
||||
|
||||
Usage::
|
||||
|
||||
from bcda.client import Client
|
||||
|
||||
with Client(client_id="...", client_secret="...") as c:
|
||||
files = c.export(
|
||||
types=["Patient", "ExplanationOfBenefit"],
|
||||
since="2025-01-01T00:00:00-05:00",
|
||||
)
|
||||
# files is a list of Path objects to downloaded ndjson files
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import gzip
|
||||
import json
|
||||
import logging
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import httpx
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
SANDBOX = "https://sandbox.bcda.cms.gov"
|
||||
PRODUCTION = "https://api.bcda.cms.gov"
|
||||
|
||||
# Defaults matching the Go reference implementation.
|
||||
MAX_RETRIES = 3
|
||||
RETRY_INITIAL_INTERVAL = 1.0 # seconds
|
||||
TOKEN_LIFETIME = 1200 # 20 minutes
|
||||
|
||||
|
||||
class BcdaError(Exception):
|
||||
"""BCDA API error."""
|
||||
|
||||
|
||||
class JobExpiredError(BcdaError):
|
||||
"""Job has been archived (server returned 410 Gone)."""
|
||||
|
||||
|
||||
class Client:
|
||||
"""BCDA bulk FHIR export client.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
client_id : str
|
||||
OAuth2 client ID issued by CMS.
|
||||
client_secret : str
|
||||
OAuth2 client secret issued by CMS.
|
||||
base_url : str
|
||||
API base URL. Defaults to sandbox.
|
||||
output_dir : str | Path
|
||||
Directory for downloaded ndjson files.
|
||||
Defaults to ``data/bcda``.
|
||||
version : str
|
||||
API version path segment. Defaults to ``v2``.
|
||||
max_retries : int
|
||||
Max retry attempts for transient errors.
|
||||
retry_interval : float
|
||||
Initial back-off interval in seconds (doubles each retry).
|
||||
timeout : float
|
||||
HTTP request timeout in seconds.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
client_id: str,
|
||||
client_secret: str,
|
||||
*,
|
||||
base_url: str = SANDBOX,
|
||||
output_dir: str | Path = "data/bcda",
|
||||
version: str = "v2",
|
||||
max_retries: int = MAX_RETRIES,
|
||||
retry_interval: float = RETRY_INITIAL_INTERVAL,
|
||||
timeout: float = 120.0,
|
||||
) -> None:
|
||||
self.client_id = client_id
|
||||
self.client_secret = client_secret
|
||||
self.base_url = base_url.rstrip("/")
|
||||
self.output_dir = Path(output_dir)
|
||||
self.version = version
|
||||
self.max_retries = max_retries
|
||||
self.retry_interval = retry_interval
|
||||
|
||||
self._token: str = ""
|
||||
self._token_expires_at: float = 0.0
|
||||
self._http = httpx.Client(timeout=timeout)
|
||||
|
||||
def close(self) -> None:
|
||||
"""Close the underlying HTTP client."""
|
||||
self._http.close()
|
||||
|
||||
def __enter__(self) -> Client:
|
||||
return self
|
||||
|
||||
def __exit__(self, *exc: object) -> None:
|
||||
self.close()
|
||||
|
||||
# ── Authentication ───────────────────────────────────────
|
||||
|
||||
def authenticate(self) -> str:
|
||||
"""Obtain a bearer token via client credentials.
|
||||
|
||||
Tokens expire after 20 minutes. Called automatically
|
||||
by other methods when the token is missing or expired.
|
||||
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
The bearer token.
|
||||
"""
|
||||
resp = self._http.post(
|
||||
f"{self.base_url}/auth/token",
|
||||
auth=(self.client_id, self.client_secret),
|
||||
headers={"Accept": "application/json"},
|
||||
content=b"",
|
||||
)
|
||||
resp.raise_for_status()
|
||||
data = resp.json()
|
||||
self._token = data["access_token"]
|
||||
expires_in = int(data.get("expires_in", TOKEN_LIFETIME))
|
||||
# Refresh 30s before actual expiry to avoid edge-case 401s.
|
||||
self._token_expires_at = time.monotonic() + expires_in - 30
|
||||
log.info("Authenticated, token expires in %ds", expires_in)
|
||||
return self._token
|
||||
|
||||
@property
|
||||
def _token_valid(self) -> bool:
|
||||
return bool(self._token) and time.monotonic() < self._token_expires_at
|
||||
|
||||
def _auth_headers(self) -> dict[str, str]:
|
||||
if not self._token_valid:
|
||||
self.authenticate()
|
||||
return {"Authorization": f"Bearer {self._token}"}
|
||||
|
||||
# ── Low-level request with retry ─────────────────────────
|
||||
|
||||
def _request(
|
||||
self,
|
||||
method: str,
|
||||
url: str,
|
||||
*,
|
||||
headers: dict[str, str] | None = None,
|
||||
params: dict[str, str] | None = None,
|
||||
auth_required: bool = True,
|
||||
retry: bool = True,
|
||||
) -> httpx.Response:
|
||||
"""Execute an HTTP request with retry and token refresh.
|
||||
|
||||
Retries on:
|
||||
- 401 Unauthorized → re-authenticate once, then retry.
|
||||
- 429 Too Many Requests → sleep for ``Retry-After``, then retry.
|
||||
- 5xx server errors → exponential back-off.
|
||||
- Connection / timeout errors → exponential back-off.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
method : str
|
||||
HTTP method (GET, POST, DELETE).
|
||||
url : str
|
||||
Fully-qualified URL.
|
||||
headers : dict | None
|
||||
Extra headers (auth headers are added automatically).
|
||||
params : dict | None
|
||||
Query parameters.
|
||||
auth_required : bool
|
||||
Whether to include bearer token.
|
||||
retry : bool
|
||||
Whether to apply retry logic.
|
||||
|
||||
Returns
|
||||
-------
|
||||
httpx.Response
|
||||
The successful response.
|
||||
"""
|
||||
merged: dict[str, str] = {}
|
||||
if auth_required:
|
||||
merged.update(self._auth_headers())
|
||||
if headers:
|
||||
merged.update(headers)
|
||||
|
||||
attempts = self.max_retries if retry else 1
|
||||
backoff = self.retry_interval
|
||||
last_exc: BaseException | None = None
|
||||
refreshed = False
|
||||
|
||||
for attempt in range(1, attempts + 1):
|
||||
try:
|
||||
resp = self._http.request(
|
||||
method,
|
||||
url,
|
||||
headers=merged,
|
||||
params=params,
|
||||
)
|
||||
except (httpx.ConnectError, httpx.ReadTimeout) as exc:
|
||||
last_exc = exc
|
||||
if attempt < attempts:
|
||||
log.warning(
|
||||
"%s %s failed (attempt %d/%d): %s — retrying in %.1fs",
|
||||
method,
|
||||
url,
|
||||
attempt,
|
||||
attempts,
|
||||
exc,
|
||||
backoff,
|
||||
)
|
||||
time.sleep(backoff)
|
||||
backoff *= 2
|
||||
continue
|
||||
raise BcdaError(
|
||||
f"{method} {url} failed after {attempts} attempts: {exc}"
|
||||
) from exc
|
||||
|
||||
# 401 — token expired; re-authenticate once and retry.
|
||||
if resp.status_code == 401 and auth_required and not refreshed:
|
||||
log.info("Got 401, refreshing token")
|
||||
self.authenticate()
|
||||
merged.update(self._auth_headers())
|
||||
refreshed = True
|
||||
continue
|
||||
|
||||
# 429 — rate limited; honor Retry-After.
|
||||
if resp.status_code == 429:
|
||||
delay = int(resp.headers.get("Retry-After", "60"))
|
||||
log.warning(
|
||||
"Rate limited (429). Sleeping %ds (attempt %d/%d)",
|
||||
delay,
|
||||
attempt,
|
||||
attempts,
|
||||
)
|
||||
time.sleep(delay)
|
||||
continue
|
||||
|
||||
# 5xx — transient server error; back off.
|
||||
if resp.status_code >= 500:
|
||||
last_exc = httpx.HTTPStatusError(
|
||||
f"Server error {resp.status_code}",
|
||||
request=resp.request,
|
||||
response=resp,
|
||||
)
|
||||
if attempt < attempts:
|
||||
log.warning(
|
||||
"%s %s returned %d (attempt %d/%d) — retrying in %.1fs",
|
||||
method,
|
||||
url,
|
||||
resp.status_code,
|
||||
attempt,
|
||||
attempts,
|
||||
backoff,
|
||||
)
|
||||
time.sleep(backoff)
|
||||
backoff *= 2
|
||||
continue
|
||||
resp.raise_for_status()
|
||||
|
||||
# 410 — job expired / archived.
|
||||
if resp.status_code == 410:
|
||||
raise JobExpiredError(
|
||||
f"Resource gone (410): {url}. "
|
||||
"Jobs expire 24 hours after completion."
|
||||
)
|
||||
|
||||
# Any other client error — fail immediately.
|
||||
resp.raise_for_status()
|
||||
return resp
|
||||
|
||||
# Should not reach here, but satisfy the type checker.
|
||||
if last_exc:
|
||||
raise BcdaError(str(last_exc)) from last_exc
|
||||
raise BcdaError("Request failed with no response")
|
||||
|
||||
# ── Export flow ──────────────────────────────────────────
|
||||
|
||||
def export(
|
||||
self,
|
||||
*,
|
||||
endpoint: str = "Group/all",
|
||||
types: list[str] | None = None,
|
||||
since: str | None = None,
|
||||
poll_interval: float = 10.0,
|
||||
) -> list[Path]:
|
||||
"""Run a full bulk export: start, poll, download.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
endpoint : str
|
||||
Export endpoint — ``"Group/all"`` (default),
|
||||
``"Group/runout"``, or ``"Patient"``.
|
||||
types : list[str] | None
|
||||
FHIR resource types to request, e.g.
|
||||
``["Patient", "ExplanationOfBenefit"]``.
|
||||
``None`` returns all available types.
|
||||
since : str | None
|
||||
FHIR instant — only return resources updated after
|
||||
this timestamp. Format: ``YYYY-MM-DDThh:mm:ss±zz:zz``.
|
||||
poll_interval : float
|
||||
Seconds between status polls. Default 10.
|
||||
|
||||
Returns
|
||||
-------
|
||||
list[Path]
|
||||
Paths to downloaded ndjson files.
|
||||
"""
|
||||
job_url = self.start_export(
|
||||
endpoint=endpoint,
|
||||
types=types,
|
||||
since=since,
|
||||
)
|
||||
result = self.poll(job_url, interval=poll_interval)
|
||||
return self.download(result)
|
||||
|
||||
def start_export(
|
||||
self,
|
||||
*,
|
||||
endpoint: str = "Group/all",
|
||||
types: list[str] | None = None,
|
||||
since: str | None = None,
|
||||
) -> str:
|
||||
"""Start a bulk export job.
|
||||
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
The job status URL (from ``Content-Location`` header).
|
||||
"""
|
||||
url = f"{self.base_url}/api/{self.version}/{endpoint}/$export"
|
||||
params: dict[str, str] = {}
|
||||
if types:
|
||||
params["_type"] = ",".join(types)
|
||||
if since:
|
||||
params["_since"] = since
|
||||
|
||||
resp = self._request(
|
||||
"GET",
|
||||
url,
|
||||
headers={
|
||||
"Accept": "application/fhir+json",
|
||||
"Prefer": "respond-async",
|
||||
},
|
||||
params=params,
|
||||
)
|
||||
|
||||
if resp.status_code != 202:
|
||||
raise BcdaError(f"Expected 202 Accepted, got {resp.status_code}")
|
||||
|
||||
job_url = resp.headers["Content-Location"]
|
||||
log.info("Export started: %s", job_url)
|
||||
return job_url
|
||||
|
||||
def poll(
|
||||
self,
|
||||
job_url: str,
|
||||
*,
|
||||
interval: float = 10.0,
|
||||
timeout: float = 0,
|
||||
) -> dict:
|
||||
"""Poll a job until complete.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
job_url : str
|
||||
The job status URL from ``start_export``.
|
||||
interval : float
|
||||
Seconds between polls.
|
||||
timeout : float
|
||||
Max seconds to wait. 0 means unlimited.
|
||||
|
||||
Returns
|
||||
-------
|
||||
dict
|
||||
The completed job response containing ``output`` list.
|
||||
|
||||
Raises
|
||||
------
|
||||
JobExpiredError
|
||||
If the job has been archived (410 Gone).
|
||||
BcdaError
|
||||
If timeout is exceeded.
|
||||
"""
|
||||
deadline = (time.monotonic() + timeout) if timeout > 0 else 0
|
||||
headers = {"Accept": "application/fhir+json"}
|
||||
|
||||
while True:
|
||||
resp = self._request("GET", job_url, headers=headers)
|
||||
|
||||
if resp.status_code == 200:
|
||||
result = resp.json()
|
||||
n_output = len(result.get("output", []))
|
||||
n_error = len(result.get("error", []))
|
||||
log.info(
|
||||
"Job complete: %d output file(s), %d error file(s)",
|
||||
n_output,
|
||||
n_error,
|
||||
)
|
||||
return result
|
||||
|
||||
if resp.status_code == 202:
|
||||
progress = resp.headers.get("X-Progress", "unknown")
|
||||
log.debug("Job in progress: %s", progress)
|
||||
if deadline and time.monotonic() + interval > deadline:
|
||||
raise BcdaError(
|
||||
f"Poll timeout after {timeout}s. Last progress: {progress}"
|
||||
)
|
||||
time.sleep(interval)
|
||||
continue
|
||||
|
||||
# Shouldn't get here — _request handles other status codes.
|
||||
resp.raise_for_status()
|
||||
|
||||
def download(
|
||||
self,
|
||||
job_result: dict,
|
||||
*,
|
||||
output_dir: Path | None = None,
|
||||
) -> list[Path]:
|
||||
"""Download all ndjson files from a completed job.
|
||||
|
||||
Files are named ``{ResourceType}.ndjson`` (e.g.
|
||||
``Patient.ndjson``). If multiple files share a type,
|
||||
a numeric suffix is appended (``ExplanationOfBenefit.1.ndjson``).
|
||||
|
||||
Parameters
|
||||
----------
|
||||
job_result : dict
|
||||
The completed job response from ``poll``.
|
||||
output_dir : Path | None
|
||||
Override output directory.
|
||||
|
||||
Returns
|
||||
-------
|
||||
list[Path]
|
||||
Paths to downloaded ndjson files.
|
||||
"""
|
||||
out = output_dir or self.output_dir
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
outputs = job_result.get("output", [])
|
||||
errors = job_result.get("error", [])
|
||||
|
||||
if errors:
|
||||
log.warning("Job has %d error file(s)", len(errors))
|
||||
|
||||
# Build filename from resource type; handle duplicates.
|
||||
type_counts: dict[str, int] = {}
|
||||
paths: list[Path] = []
|
||||
|
||||
for entry in outputs:
|
||||
url = entry["url"]
|
||||
resource_type = entry.get("type", "unknown")
|
||||
|
||||
count = type_counts.get(resource_type, 0)
|
||||
type_counts[resource_type] = count + 1
|
||||
if count == 0:
|
||||
filename = f"{resource_type}.ndjson"
|
||||
else:
|
||||
filename = f"{resource_type}.{count}.ndjson"
|
||||
|
||||
dest = out / filename
|
||||
log.info("Downloading %s -> %s", resource_type, dest)
|
||||
self._download_file(url, dest)
|
||||
paths.append(dest)
|
||||
log.info("Downloaded %s (%d bytes)", dest.name, dest.stat().st_size)
|
||||
|
||||
# Also download error files if present.
|
||||
for entry in errors:
|
||||
url = entry["url"]
|
||||
resource_type = entry.get("type", "error")
|
||||
uuid_name = url.rsplit("/", 1)[-1]
|
||||
dest = out / f"{resource_type}-error-{uuid_name}"
|
||||
log.info("Downloading error file -> %s", dest)
|
||||
self._download_file(url, dest)
|
||||
|
||||
return paths
|
||||
|
||||
def _download_file(self, url: str, dest: Path) -> None:
|
||||
"""Stream-download a file, decompressing gzip if needed."""
|
||||
headers = {
|
||||
**self._auth_headers(),
|
||||
"Accept-Encoding": "gzip",
|
||||
}
|
||||
with self._http.stream("GET", url, headers=headers) as resp:
|
||||
resp.raise_for_status()
|
||||
|
||||
content_encoding = resp.headers.get("Content-Encoding", "")
|
||||
raw_bytes = b"".join(resp.iter_bytes())
|
||||
|
||||
# Server may send gzip-compressed data. The response might
|
||||
# also just start with the gzip magic bytes if the server
|
||||
# stored it compressed. Detect and decompress either way.
|
||||
if content_encoding == "gzip" or raw_bytes[:2] == b"\x1f\x8b":
|
||||
try:
|
||||
raw_bytes = gzip.decompress(raw_bytes)
|
||||
except gzip.BadGzipFile:
|
||||
pass # Not actually gzip; use as-is.
|
||||
|
||||
dest.write_bytes(raw_bytes)
|
||||
|
||||
# ── Job management ───────────────────────────────────────
|
||||
|
||||
def cancel(self, job_url: str) -> None:
|
||||
"""Cancel a running export job.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
job_url : str
|
||||
The job status URL from ``start_export``.
|
||||
"""https://github.com/CMSgov/bcda-app/blob/main/bcda/client/fhir/client.go
|
||||
self._request("DELETE", job_url)
|
||||
log.info("Job cancelled: %s", job_url)
|
||||
|
||||
def jobs(self, *, status: str | None = None) -> list[dict]:
|
||||
"""List previous export jobs.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
status : str | None
|
||||
Filter by status: ``"Archived"``, ``"Pending"``,
|
||||
``"In Progress"``, ``"Cancelled"``,
|
||||
``"Completed"``, ``"Failed"``.
|
||||
|
||||
Returns
|
||||
-------
|
||||
list[dict]
|
||||
Job history entries.
|
||||
"""
|
||||
url = f"{self.base_url}/api/{self.version}/jobs"
|
||||
params: dict[str, str] = {}
|
||||
if status:
|
||||
params["_status"] = status
|
||||
resp = self._request("GET", url, params=params)
|
||||
return resp.json()
|
||||
|
||||
def attribution_status(self) -> dict:
|
||||
"""Get last ingestion timestamps for attribution data.
|
||||
|
||||
Returns
|
||||
-------
|
||||
dict
|
||||
Timestamps for attribution and runout data.
|
||||
"""
|
||||
url = f"{self.base_url}/api/{self.version}/attribution_status"
|
||||
resp = self._request("GET", url)
|
||||
return resp.json()
|
||||
|
||||
def metadata(self) -> dict:
|
||||
"""Get FHIR CapabilityStatement (no auth required).
|
||||
|
||||
Returns
|
||||
-------
|
||||
dict
|
||||
Server capability statement with version info.
|
||||
"""
|
||||
url = f"{self.base_url}/api/{self.version}/metadata"
|
||||
resp = self._request("GET", url, auth_required=False, retry=False)
|
||||
return resp.json()
|
||||
|
||||
# ── Parsing helpers ──────────────────────────────────────
|
||||
|
||||
@staticmethod
|
||||
def read_ndjson(path: Path) -> list[dict]:
|
||||
"""Read an ndjson file into a list of dicts.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
path : Path
|
||||
Path to an ``.ndjson`` file.
|
||||
|
||||
Returns
|
||||
-------
|
||||
list[dict]
|
||||
One dict per line (FHIR resource).
|
||||
"""
|
||||
with open(path) as f:
|
||||
return [json.loads(line) for line in f if line.strip()]
|
||||
0
src/bcda/express/__init__.py
Normal file
0
src/bcda/express/__init__.py
Normal file
BIN
src/bcda/express/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
src/bcda/express/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/express/__pycache__/cclf.cpython-313.pyc
Normal file
BIN
src/bcda/express/__pycache__/cclf.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/express/__pycache__/flatten.cpython-313.pyc
Normal file
BIN
src/bcda/express/__pycache__/flatten.cpython-313.pyc
Normal file
Binary file not shown.
669
src/bcda/express/cclf.py
Normal file
669
src/bcda/express/cclf.py
Normal file
@@ -0,0 +1,669 @@
|
||||
"""BCDA FHIR R4 connector — EOB + Patient + Coverage → input_layer tables.
|
||||
|
||||
Transforms flattened BCDA FHIR R4 resources into three input_layer
|
||||
output tables that match what the CCLF pipeline produces:
|
||||
|
||||
- input_layer.medical_claim (Part A + Part B carrier + Part B DME)
|
||||
- input_layer.pharmacy_claim (Part D)
|
||||
- input_layer.eligibility (Patient + Coverage)
|
||||
|
||||
Unlike the CCLF pipeline (19 functions), this pipeline is simpler
|
||||
(12 functions) because BCDA delivers:
|
||||
- Current MBIs directly (no CCLF9 crosswalk needed)
|
||||
- Final-action claims only (no ADR debit/credit reconciliation)
|
||||
- Inline diagnosis codes (no CCLF4 long→wide pivot)
|
||||
|
||||
Claim routing uses ``nch_near_line_rec_ident_cd``:
|
||||
V → Part A institutional → medical_claim (institutional)
|
||||
O → Part B carrier → medical_claim (professional)
|
||||
M → Part B DME → medical_claim (professional)
|
||||
P → Part D pharmacy → pharmacy_claim
|
||||
|
||||
Pipeline stages::
|
||||
|
||||
BCDA FHIR R4 resources
|
||||
│
|
||||
▼ stg: filter by claim type, resolve MBI
|
||||
│
|
||||
▼ int: join header + items, map to input_layer schema
|
||||
│
|
||||
▼ final: medical_claim, pharmacy_claim, eligibility
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import narwhals as nw
|
||||
from narwhals.typing import FrameT
|
||||
|
||||
# ── Helpers ──────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def _icd_indicator() -> nw.Expr:
|
||||
"""Map dgns_prcdr_icd_ind to standard code type."""
|
||||
return (
|
||||
nw.when(nw.col("dgns_prcdr_icd_ind") == "0")
|
||||
.then(nw.lit("icd-10-cm"))
|
||||
.otherwise(
|
||||
nw.when(nw.col("dgns_prcdr_icd_ind") == "9")
|
||||
.then(nw.lit("icd-9-cm"))
|
||||
.otherwise(nw.lit(None))
|
||||
)
|
||||
.alias("diagnosis_code_type")
|
||||
)
|
||||
|
||||
|
||||
# ── Stage 1: Beneficiary XREF ───────────────────────────────────
|
||||
|
||||
|
||||
@nw.narwhalify
|
||||
def stg_beneficiary_xref(
|
||||
bcda__patient: FrameT,
|
||||
) -> FrameT:
|
||||
"""Build MBI crosswalk from BCDA Patient identifiers.
|
||||
|
||||
BCDA Patient delivers the current MBI directly in bene_mbi_id.
|
||||
This deduplicates to one row per beneficiary with a stable
|
||||
bene_id and the current MBI.
|
||||
|
||||
Operations: select, unique
|
||||
Dependencies: bcda.patient
|
||||
"""
|
||||
return bcda__patient.select(
|
||||
nw.col("bene_id"),
|
||||
nw.col("bene_mbi_id").alias("current_bene_mbi_id"),
|
||||
).unique(subset=["bene_id"], keep="any")
|
||||
|
||||
|
||||
# ── Stage 2: Part A Institutional Claims ─────────────────────────
|
||||
|
||||
|
||||
@nw.narwhalify
|
||||
def stg_part_a_header(
|
||||
bcda__explanation_of_benefit: FrameT,
|
||||
bcda___stg_beneficiary_xref: FrameT,
|
||||
) -> FrameT:
|
||||
"""Filter EOB to Part A claims and resolve MBI.
|
||||
|
||||
Filter: nch_near_line_rec_ident_cd == 'V'
|
||||
Join: bene_id → current_bene_mbi_id from xref
|
||||
|
||||
Operations: filter, join
|
||||
Dependencies: bcda.explanation_of_benefit, bcda._stg_beneficiary_xref
|
||||
"""
|
||||
xref = bcda___stg_beneficiary_xref
|
||||
return bcda__explanation_of_benefit.filter(
|
||||
nw.col("nch_near_line_rec_ident_cd") == "V"
|
||||
).join(xref, on="bene_id", how="left")
|
||||
|
||||
|
||||
@nw.narwhalify
|
||||
def int_institutional_medical_claim(
|
||||
bcda___stg_part_a_header: FrameT,
|
||||
bcda__eob_item: FrameT,
|
||||
) -> FrameT:
|
||||
"""Join Part A header + line items → medical_claim (institutional).
|
||||
|
||||
Operations: join, select
|
||||
Dependencies: bcda._stg_part_a_header, bcda.eob_item
|
||||
"""
|
||||
hdr = bcda___stg_part_a_header
|
||||
items = bcda__eob_item
|
||||
|
||||
df = hdr.join(items, on="clm_id", how="inner", suffix="_item")
|
||||
|
||||
# Diagnosis codes 1-12 from EOB header, 13-25 null
|
||||
dx_cols = []
|
||||
for i in range(1, 26):
|
||||
if i <= 12:
|
||||
dx_cols.append(nw.col(f"clm_dgns_{i}_cd").alias(f"diagnosis_code_{i}"))
|
||||
else:
|
||||
dx_cols.append(nw.lit(None).cast(nw.String).alias(f"diagnosis_code_{i}"))
|
||||
|
||||
# POA: slot 1 from header, rest null
|
||||
poa_cols = []
|
||||
for i in range(1, 26):
|
||||
if i == 1:
|
||||
poa_cols.append(nw.col("clm_poa_ind").alias("diagnosis_poa_1"))
|
||||
else:
|
||||
poa_cols.append(nw.lit(None).cast(nw.String).alias(f"diagnosis_poa_{i}"))
|
||||
|
||||
# Procedure: slot 1 from header, rest null
|
||||
px_code_cols = [
|
||||
nw.col("clm_prcdr_cd").alias("procedure_code_1"),
|
||||
*[
|
||||
nw.lit(None).cast(nw.String).alias(f"procedure_code_{i}")
|
||||
for i in range(2, 26)
|
||||
],
|
||||
]
|
||||
px_date_cols = [
|
||||
nw.col("clm_prcdr_prfrm_dt").alias("procedure_date_1"),
|
||||
*[
|
||||
nw.lit(None).cast(nw.Date).alias(f"procedure_date_{i}")
|
||||
for i in range(2, 26)
|
||||
],
|
||||
]
|
||||
|
||||
null_str = nw.lit(None).cast(nw.String)
|
||||
null_date = nw.lit(None).cast(nw.Date)
|
||||
null_float = nw.lit(None).cast(nw.Float64)
|
||||
|
||||
return df.select(
|
||||
nw.col("clm_id").alias("claim_id"),
|
||||
nw.col("clm_line_num").cast(nw.Int64).alias("claim_line_number"),
|
||||
nw.lit("institutional").alias("claim_type"),
|
||||
nw.col("current_bene_mbi_id").alias("person_id"),
|
||||
nw.col("current_bene_mbi_id").alias("member_id"),
|
||||
nw.lit("medicare").alias("payer"),
|
||||
nw.lit("medicare").alias("plan"),
|
||||
nw.col("clm_from_dt").alias("claim_start_date"),
|
||||
nw.col("clm_thru_dt").alias("claim_end_date"),
|
||||
nw.col("clm_line_from_dt").alias("claim_line_start_date"),
|
||||
nw.col("clm_line_thru_dt").alias("claim_line_end_date"),
|
||||
nw.col("clm_from_dt").alias("admission_date"),
|
||||
nw.col("clm_thru_dt").alias("discharge_date"),
|
||||
nw.col("clm_admsn_src_cd").alias("admit_source_code"),
|
||||
nw.col("clm_admsn_type_cd").alias("admit_type_code"),
|
||||
nw.col("bene_ptnt_stus_cd").alias("discharge_disposition_code"),
|
||||
null_str.alias("place_of_service_code"),
|
||||
# bill_type_code = fac + clsfctn + freq
|
||||
(
|
||||
nw.col("clm_bill_fac_type_cd").cast(nw.String).fill_null("")
|
||||
+ nw.col("clm_bill_clsfctn_cd").cast(nw.String).fill_null("")
|
||||
+ nw.col("clm_bill_freq_cd").cast(nw.String).fill_null("")
|
||||
).alias("bill_type_code"),
|
||||
nw.lit("ms-drg").alias("drg_code_type"),
|
||||
nw.col("dgns_drg_cd").cast(nw.String).str.slice(-3).alias("drg_code"),
|
||||
nw.col("clm_line_prod_rev_ctr_cd").alias("revenue_center_code"),
|
||||
nw.col("clm_line_srvc_unit_qty").cast(nw.Int64).alias("service_unit_quantity"),
|
||||
nw.col("clm_line_hcpcs_cd").alias("hcpcs_code"),
|
||||
nw.col("hcpcs_1_mdfr_cd").alias("hcpcs_modifier_1"),
|
||||
nw.col("hcpcs_2_mdfr_cd").alias("hcpcs_modifier_2"),
|
||||
nw.col("hcpcs_3_mdfr_cd").alias("hcpcs_modifier_3"),
|
||||
nw.col("hcpcs_4_mdfr_cd").alias("hcpcs_modifier_4"),
|
||||
nw.col("hcpcs_5_mdfr_cd").alias("hcpcs_modifier_5"),
|
||||
nw.col("oprtg_prvdr_npi_num").alias("rendering_npi"),
|
||||
null_str.alias("rendering_tin"),
|
||||
nw.col("fac_prvdr_npi_num").alias("billing_npi"),
|
||||
null_str.alias("billing_tin"),
|
||||
nw.col("fac_prvdr_npi_num").alias("facility_npi"),
|
||||
null_date.alias("paid_date"),
|
||||
nw.col("clm_line_cvrd_pd_amt").cast(nw.Float64).alias("paid_amount"),
|
||||
null_float.alias("allowed_amount"),
|
||||
nw.col("clm_mdcr_instnl_tot_chrg_amt").cast(nw.Float64).alias("charge_amount"),
|
||||
null_float.alias("coinsurance_amount"),
|
||||
null_float.alias("copayment_amount"),
|
||||
null_float.alias("deductible_amount"),
|
||||
null_float.alias("total_cost_amount"),
|
||||
_icd_indicator(),
|
||||
*dx_cols,
|
||||
*poa_cols,
|
||||
nw.when(nw.col("dgns_prcdr_icd_ind") == "0")
|
||||
.then(nw.lit("icd-10-pcs"))
|
||||
.otherwise(
|
||||
nw.when(nw.col("dgns_prcdr_icd_ind") == "9")
|
||||
.then(nw.lit("icd-9-pcs"))
|
||||
.otherwise(nw.lit(None))
|
||||
)
|
||||
.alias("procedure_code_type"),
|
||||
*px_code_cols,
|
||||
*px_date_cols,
|
||||
nw.lit(1).alias("in_network_flag"),
|
||||
nw.lit("medicare bcda").alias("data_source"),
|
||||
null_str.alias("file_name"),
|
||||
null_date.alias("file_date"),
|
||||
nw.lit(None).cast(nw.Datetime).alias("ingest_datetime"),
|
||||
)
|
||||
|
||||
|
||||
# ── Stage 3: Part B Physician Claims ────────────────────────────
|
||||
|
||||
|
||||
@nw.narwhalify
|
||||
def stg_part_b_physician_header(
|
||||
bcda__explanation_of_benefit: FrameT,
|
||||
bcda___stg_beneficiary_xref: FrameT,
|
||||
) -> FrameT:
|
||||
"""Filter EOB to Part B carrier claims and resolve MBI.
|
||||
|
||||
Filter: nch_near_line_rec_ident_cd == 'O'
|
||||
|
||||
Operations: filter, join
|
||||
Dependencies: bcda.explanation_of_benefit, bcda._stg_beneficiary_xref
|
||||
"""
|
||||
xref = bcda___stg_beneficiary_xref
|
||||
return bcda__explanation_of_benefit.filter(
|
||||
nw.col("nch_near_line_rec_ident_cd") == "O"
|
||||
).join(xref, on="bene_id", how="left")
|
||||
|
||||
|
||||
@nw.narwhalify
|
||||
def int_physician_medical_claim(
|
||||
bcda___stg_part_b_physician_header: FrameT,
|
||||
bcda__eob_item: FrameT,
|
||||
) -> FrameT:
|
||||
"""Join Part B physician header + line items → medical_claim.
|
||||
|
||||
claim_type = 'professional'. CCLF5 equivalent.
|
||||
|
||||
Operations: join, select
|
||||
Dependencies: bcda._stg_part_b_physician_header, bcda.eob_item
|
||||
"""
|
||||
hdr = bcda___stg_part_b_physician_header
|
||||
items = bcda__eob_item
|
||||
|
||||
df = hdr.join(items, on="clm_id", how="inner", suffix="_item")
|
||||
|
||||
# Diagnosis codes 1-12 from EOB header, 13-25 null
|
||||
dx_cols = []
|
||||
for i in range(1, 26):
|
||||
if i <= 12:
|
||||
dx_cols.append(nw.col(f"clm_dgns_{i}_cd").alias(f"diagnosis_code_{i}"))
|
||||
else:
|
||||
dx_cols.append(nw.lit(None).cast(nw.String).alias(f"diagnosis_code_{i}"))
|
||||
|
||||
poa_cols = [
|
||||
nw.lit(None).cast(nw.String).alias(f"diagnosis_poa_{i}") for i in range(1, 26)
|
||||
]
|
||||
px_code_cols = [
|
||||
nw.lit(None).cast(nw.String).alias(f"procedure_code_{i}") for i in range(1, 26)
|
||||
]
|
||||
px_date_cols = [
|
||||
nw.lit(None).cast(nw.Date).alias(f"procedure_date_{i}") for i in range(1, 26)
|
||||
]
|
||||
|
||||
null_str = nw.lit(None).cast(nw.String)
|
||||
null_date = nw.lit(None).cast(nw.Date)
|
||||
null_float = nw.lit(None).cast(nw.Float64)
|
||||
|
||||
return df.select(
|
||||
nw.col("clm_id").alias("claim_id"),
|
||||
nw.col("clm_line_num").cast(nw.Int64).alias("claim_line_number"),
|
||||
nw.lit("professional").alias("claim_type"),
|
||||
nw.col("current_bene_mbi_id").alias("person_id"),
|
||||
nw.col("current_bene_mbi_id").alias("member_id"),
|
||||
nw.lit("medicare").alias("payer"),
|
||||
nw.lit("medicare").alias("plan"),
|
||||
nw.col("clm_from_dt").alias("claim_start_date"),
|
||||
nw.col("clm_thru_dt").alias("claim_end_date"),
|
||||
nw.col("clm_line_from_dt").alias("claim_line_start_date"),
|
||||
nw.col("clm_line_thru_dt").alias("claim_line_end_date"),
|
||||
null_date.alias("admission_date"),
|
||||
null_date.alias("discharge_date"),
|
||||
null_str.alias("admit_source_code"),
|
||||
null_str.alias("admit_type_code"),
|
||||
null_str.alias("discharge_disposition_code"),
|
||||
nw.col("clm_pos_cd").alias("place_of_service_code"),
|
||||
null_str.alias("bill_type_code"),
|
||||
null_str.alias("drg_code_type"),
|
||||
null_str.alias("drg_code"),
|
||||
null_str.alias("revenue_center_code"),
|
||||
nw.col("clm_line_srvc_unit_qty").cast(nw.Int64).alias("service_unit_quantity"),
|
||||
nw.col("clm_line_hcpcs_cd").alias("hcpcs_code"),
|
||||
nw.col("hcpcs_1_mdfr_cd").alias("hcpcs_modifier_1"),
|
||||
nw.col("hcpcs_2_mdfr_cd").alias("hcpcs_modifier_2"),
|
||||
nw.col("hcpcs_3_mdfr_cd").alias("hcpcs_modifier_3"),
|
||||
nw.col("hcpcs_4_mdfr_cd").alias("hcpcs_modifier_4"),
|
||||
nw.col("hcpcs_5_mdfr_cd").alias("hcpcs_modifier_5"),
|
||||
nw.col("rndrg_prvdr_npi_num").alias("rendering_npi"),
|
||||
nw.col("clm_rndrg_prvdr_tax_num").alias("rendering_tin"),
|
||||
nw.col("carr_clm_blg_npi_num").alias("billing_npi"),
|
||||
null_str.alias("billing_tin"),
|
||||
null_str.alias("facility_npi"),
|
||||
null_date.alias("paid_date"),
|
||||
nw.col("clm_line_cvrd_pd_amt").cast(nw.Float64).alias("paid_amount"),
|
||||
nw.col("clm_line_alowd_chrg_amt").cast(nw.Float64).alias("allowed_amount"),
|
||||
null_float.alias("charge_amount"),
|
||||
null_float.alias("coinsurance_amount"),
|
||||
null_float.alias("copayment_amount"),
|
||||
null_float.alias("deductible_amount"),
|
||||
null_float.alias("total_cost_amount"),
|
||||
_icd_indicator(),
|
||||
*dx_cols,
|
||||
*poa_cols,
|
||||
null_str.alias("procedure_code_type"),
|
||||
*px_code_cols,
|
||||
*px_date_cols,
|
||||
nw.lit(1).alias("in_network_flag"),
|
||||
nw.lit("medicare bcda").alias("data_source"),
|
||||
null_str.alias("file_name"),
|
||||
null_date.alias("file_date"),
|
||||
nw.lit(None).cast(nw.Datetime).alias("ingest_datetime"),
|
||||
)
|
||||
|
||||
|
||||
# ── Stage 4: Part B DME Claims ──────────────────────────────────
|
||||
|
||||
|
||||
@nw.narwhalify
|
||||
def stg_part_b_dme_header(
|
||||
bcda__explanation_of_benefit: FrameT,
|
||||
bcda___stg_beneficiary_xref: FrameT,
|
||||
) -> FrameT:
|
||||
"""Filter EOB to Part B DME claims and resolve MBI.
|
||||
|
||||
Filter: nch_near_line_rec_ident_cd == 'M'
|
||||
|
||||
Operations: filter, join
|
||||
Dependencies: bcda.explanation_of_benefit, bcda._stg_beneficiary_xref
|
||||
"""
|
||||
xref = bcda___stg_beneficiary_xref
|
||||
return bcda__explanation_of_benefit.filter(
|
||||
nw.col("nch_near_line_rec_ident_cd") == "M"
|
||||
).join(xref, on="bene_id", how="left")
|
||||
|
||||
|
||||
@nw.narwhalify
|
||||
def int_dme_medical_claim(
|
||||
bcda___stg_part_b_dme_header: FrameT,
|
||||
bcda__eob_item: FrameT,
|
||||
) -> FrameT:
|
||||
"""Join Part B DME header + line items → medical_claim.
|
||||
|
||||
claim_type = 'professional'. CCLF6 equivalent.
|
||||
DME claims have no inline diagnosis or procedure codes.
|
||||
|
||||
Operations: join, select
|
||||
Dependencies: bcda._stg_part_b_dme_header, bcda.eob_item
|
||||
"""
|
||||
hdr = bcda___stg_part_b_dme_header
|
||||
items = bcda__eob_item
|
||||
|
||||
df = hdr.join(items, on="clm_id", how="inner", suffix="_item")
|
||||
|
||||
null_str = nw.lit(None).cast(nw.String)
|
||||
null_date = nw.lit(None).cast(nw.Date)
|
||||
null_float = nw.lit(None).cast(nw.Float64)
|
||||
|
||||
dx_cols = [null_str.alias(f"diagnosis_code_{i}") for i in range(1, 26)]
|
||||
poa_cols = [null_str.alias(f"diagnosis_poa_{i}") for i in range(1, 26)]
|
||||
px_code_cols = [null_str.alias(f"procedure_code_{i}") for i in range(1, 26)]
|
||||
px_date_cols = [null_date.alias(f"procedure_date_{i}") for i in range(1, 26)]
|
||||
|
||||
return df.select(
|
||||
nw.col("clm_id").alias("claim_id"),
|
||||
nw.col("clm_line_num").cast(nw.Int64).alias("claim_line_number"),
|
||||
nw.lit("professional").alias("claim_type"),
|
||||
nw.col("current_bene_mbi_id").alias("person_id"),
|
||||
nw.col("current_bene_mbi_id").alias("member_id"),
|
||||
nw.lit("medicare").alias("payer"),
|
||||
nw.lit("medicare").alias("plan"),
|
||||
nw.col("clm_from_dt").alias("claim_start_date"),
|
||||
nw.col("clm_thru_dt").alias("claim_end_date"),
|
||||
nw.col("clm_line_from_dt").alias("claim_line_start_date"),
|
||||
nw.col("clm_line_thru_dt").alias("claim_line_end_date"),
|
||||
null_date.alias("admission_date"),
|
||||
null_date.alias("discharge_date"),
|
||||
null_str.alias("admit_source_code"),
|
||||
null_str.alias("admit_type_code"),
|
||||
null_str.alias("discharge_disposition_code"),
|
||||
nw.col("clm_pos_cd").alias("place_of_service_code"),
|
||||
null_str.alias("bill_type_code"),
|
||||
null_str.alias("drg_code_type"),
|
||||
null_str.alias("drg_code"),
|
||||
null_str.alias("revenue_center_code"),
|
||||
nw.lit(None).cast(nw.Int64).alias("service_unit_quantity"),
|
||||
nw.col("clm_line_hcpcs_cd").alias("hcpcs_code"),
|
||||
null_str.alias("hcpcs_modifier_1"),
|
||||
null_str.alias("hcpcs_modifier_2"),
|
||||
null_str.alias("hcpcs_modifier_3"),
|
||||
null_str.alias("hcpcs_modifier_4"),
|
||||
null_str.alias("hcpcs_modifier_5"),
|
||||
nw.col("ordrg_prvdr_npi_num").alias("rendering_npi"),
|
||||
null_str.alias("rendering_tin"),
|
||||
nw.col("payto_prvdr_npi_num").alias("billing_npi"),
|
||||
null_str.alias("billing_tin"),
|
||||
null_str.alias("facility_npi"),
|
||||
null_date.alias("paid_date"),
|
||||
nw.col("clm_line_cvrd_pd_amt").cast(nw.Float64).alias("paid_amount"),
|
||||
nw.col("clm_line_alowd_chrg_amt").cast(nw.Float64).alias("allowed_amount"),
|
||||
null_float.alias("charge_amount"),
|
||||
null_float.alias("coinsurance_amount"),
|
||||
null_float.alias("copayment_amount"),
|
||||
null_float.alias("deductible_amount"),
|
||||
null_float.alias("total_cost_amount"),
|
||||
null_str.alias("diagnosis_code_type"),
|
||||
*dx_cols,
|
||||
*poa_cols,
|
||||
null_str.alias("procedure_code_type"),
|
||||
*px_code_cols,
|
||||
*px_date_cols,
|
||||
nw.lit(1).alias("in_network_flag"),
|
||||
nw.lit("medicare bcda").alias("data_source"),
|
||||
null_str.alias("file_name"),
|
||||
null_date.alias("file_date"),
|
||||
nw.lit(None).cast(nw.Datetime).alias("ingest_datetime"),
|
||||
)
|
||||
|
||||
|
||||
# ── Stage 5: Union medical claims ───────────────────────────────
|
||||
|
||||
|
||||
@nw.narwhalify
|
||||
def medical_claim(
|
||||
bcda___int_institutional_medical_claim: FrameT,
|
||||
bcda___int_physician_medical_claim: FrameT,
|
||||
bcda___int_dme_medical_claim: FrameT,
|
||||
) -> FrameT:
|
||||
"""Union institutional + professional + DME into medical_claim.
|
||||
|
||||
Operations: concat
|
||||
Dependencies: bcda._int_institutional_medical_claim,
|
||||
bcda._int_physician_medical_claim,
|
||||
bcda._int_dme_medical_claim
|
||||
"""
|
||||
frames = [
|
||||
bcda___int_institutional_medical_claim,
|
||||
bcda___int_physician_medical_claim,
|
||||
bcda___int_dme_medical_claim,
|
||||
]
|
||||
# Cast all columns to String to align schemas — null-only
|
||||
# columns may be inferred as Int32 by the backend engine.
|
||||
cols = frames[0].collect_schema().names()
|
||||
aligned = [f.with_columns(nw.col(c).cast(nw.String) for c in cols) for f in frames]
|
||||
return nw.concat(aligned)
|
||||
|
||||
|
||||
# ── Stage 6: Part D Pharmacy Claims ─────────────────────────────
|
||||
|
||||
|
||||
@nw.narwhalify
|
||||
def stg_part_d_header(
|
||||
bcda__explanation_of_benefit: FrameT,
|
||||
bcda___stg_beneficiary_xref: FrameT,
|
||||
) -> FrameT:
|
||||
"""Filter EOB to Part D pharmacy claims and resolve MBI.
|
||||
|
||||
Filter: nch_near_line_rec_ident_cd == 'P'
|
||||
|
||||
Operations: filter, join
|
||||
Dependencies: bcda.explanation_of_benefit, bcda._stg_beneficiary_xref
|
||||
"""
|
||||
xref = bcda___stg_beneficiary_xref
|
||||
return bcda__explanation_of_benefit.filter(
|
||||
nw.col("nch_near_line_rec_ident_cd") == "P"
|
||||
).join(xref, on="bene_id", how="left")
|
||||
|
||||
|
||||
@nw.narwhalify
|
||||
def pharmacy_claim(
|
||||
bcda___stg_part_d_header: FrameT,
|
||||
bcda__eob_item: FrameT,
|
||||
) -> FrameT:
|
||||
"""Join Part D header + line items → pharmacy_claim.
|
||||
|
||||
CCLF7 equivalent. BCDA FHIR careTeam already resolves
|
||||
provider identifiers to NPI type, so no qualifier check
|
||||
is needed (unlike CCLF7 which requires
|
||||
prvdr_srvc_id_qlfyr_cd == '01').
|
||||
|
||||
Operations: join, select
|
||||
Dependencies: bcda._stg_part_d_header, bcda.eob_item
|
||||
"""
|
||||
hdr = bcda___stg_part_d_header
|
||||
items = bcda__eob_item
|
||||
|
||||
df = hdr.join(items, on="clm_id", how="inner", suffix="_item")
|
||||
|
||||
null_float = nw.lit(None).cast(nw.Float64)
|
||||
|
||||
return df.select(
|
||||
nw.col("pde_id").alias("claim_id"),
|
||||
nw.lit(1).alias("claim_line_number"),
|
||||
nw.col("current_bene_mbi_id").alias("person_id"),
|
||||
nw.col("current_bene_mbi_id").alias("member_id"),
|
||||
nw.lit("medicare").alias("payer"),
|
||||
nw.lit("medicare").alias("plan"),
|
||||
nw.col("clm_prsbng_prvdr_gnrc_id_num")
|
||||
.cast(nw.String)
|
||||
.alias("prescribing_provider_npi"),
|
||||
nw.col("clm_srvc_prvdr_gnrc_id_num")
|
||||
.cast(nw.String)
|
||||
.alias("dispensing_provider_npi"),
|
||||
nw.col("clm_line_from_dt").alias("dispensing_date"),
|
||||
nw.col("clm_line_ndc_cd").alias("ndc_code"),
|
||||
nw.col("clm_line_srvc_unit_qty").cast(nw.Int64).alias("quantity"),
|
||||
nw.col("clm_line_days_suply_qty").cast(nw.Int64).alias("days_supply"),
|
||||
nw.col("clm_line_rx_fill_num").cast(nw.Int64).alias("refills"),
|
||||
nw.col("clm_line_from_dt").alias("paid_date"),
|
||||
nw.col("clm_line_bene_pmt_amt").cast(nw.Float64).alias("paid_amount"),
|
||||
null_float.alias("allowed_amount"),
|
||||
null_float.alias("charge_amount"),
|
||||
null_float.alias("coinsurance_amount"),
|
||||
nw.col("clm_line_bene_pmt_amt").cast(nw.Float64).alias("copayment_amount"),
|
||||
null_float.alias("deductible_amount"),
|
||||
nw.lit(1).alias("in_network_flag"),
|
||||
nw.lit("medicare bcda").alias("data_source"),
|
||||
nw.lit(None).cast(nw.String).alias("file_name"),
|
||||
nw.lit(None).cast(nw.Date).alias("file_date"),
|
||||
nw.lit(None).cast(nw.Datetime).alias("ingest_datetime"),
|
||||
)
|
||||
|
||||
|
||||
# ── Stage 7: Eligibility ────────────────────────────────────────
|
||||
|
||||
|
||||
@nw.narwhalify
|
||||
def stg_beneficiary_demographics(
|
||||
bcda__patient: FrameT,
|
||||
bcda__coverage: FrameT,
|
||||
) -> FrameT:
|
||||
"""Join Patient + Coverage for demographics and enrollment.
|
||||
|
||||
Patient provides: name, dob, sex, race, death_dt, address
|
||||
Coverage provides: ms_cd, orec, enrollment periods
|
||||
|
||||
Join on bene_mbi_id = subscriber_id. Coverage may have
|
||||
multiple rows per beneficiary (Part A, B, D); we keep
|
||||
the first match after dedup.
|
||||
|
||||
Operations: join, unique
|
||||
Dependencies: bcda.patient, bcda.coverage
|
||||
"""
|
||||
cov = bcda__coverage.unique(subset=["subscriber_id"], keep="any")
|
||||
return bcda__patient.join(
|
||||
cov,
|
||||
left_on="bene_mbi_id",
|
||||
right_on="subscriber_id",
|
||||
how="left",
|
||||
suffix="_cov",
|
||||
).unique(subset=["bene_mbi_id"], keep="any")
|
||||
|
||||
|
||||
@nw.narwhalify
|
||||
def eligibility(
|
||||
bcda___stg_beneficiary_demographics: FrameT,
|
||||
) -> FrameT:
|
||||
"""Map Patient + Coverage to eligibility schema.
|
||||
|
||||
Gender crosswalk: 1→male, 2→female, else unknown
|
||||
Race crosswalk: 1→white, 2→black, 3→other, 4→asian,
|
||||
5→hispanic, 6→native, else unknown
|
||||
|
||||
Operations: select
|
||||
Dependencies: bcda._stg_beneficiary_demographics
|
||||
"""
|
||||
df = bcda___stg_beneficiary_demographics
|
||||
null_str = nw.lit(None).cast(nw.String)
|
||||
|
||||
gender = (
|
||||
nw.when(nw.col("bene_sex_cd") == "1")
|
||||
.then(nw.lit("male"))
|
||||
.otherwise(
|
||||
nw.when(nw.col("bene_sex_cd") == "2")
|
||||
.then(nw.lit("female"))
|
||||
.otherwise(nw.lit("unknown"))
|
||||
)
|
||||
.alias("gender")
|
||||
)
|
||||
|
||||
race = (
|
||||
nw.when(nw.col("bene_race_cd") == "1")
|
||||
.then(nw.lit("white"))
|
||||
.otherwise(
|
||||
nw.when(nw.col("bene_race_cd") == "2")
|
||||
.then(nw.lit("black"))
|
||||
.otherwise(
|
||||
nw.when(nw.col("bene_race_cd") == "3")
|
||||
.then(nw.lit("other"))
|
||||
.otherwise(
|
||||
nw.when(nw.col("bene_race_cd") == "4")
|
||||
.then(nw.lit("asian"))
|
||||
.otherwise(
|
||||
nw.when(nw.col("bene_race_cd") == "5")
|
||||
.then(nw.lit("hispanic"))
|
||||
.otherwise(
|
||||
nw.when(nw.col("bene_race_cd") == "6")
|
||||
.then(nw.lit("native"))
|
||||
.otherwise(nw.lit("unknown"))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
.alias("race")
|
||||
)
|
||||
|
||||
return df.select(
|
||||
nw.col("bene_mbi_id").alias("person_id"),
|
||||
nw.col("bene_mbi_id").alias("member_id"),
|
||||
null_str.alias("subscriber_id"),
|
||||
gender,
|
||||
race,
|
||||
nw.col("bene_dob").alias("birth_date"),
|
||||
nw.col("bene_death_dt").alias("death_date"),
|
||||
nw.when(~nw.col("bene_death_dt").is_null())
|
||||
.then(nw.lit(1))
|
||||
.otherwise(nw.lit(0))
|
||||
.alias("death_flag"),
|
||||
nw.col("bene_part_a_enrlmt_bgn_dt").alias("enrollment_start_date"),
|
||||
nw.col("mdcr_covg_a_end_dt").alias("enrollment_end_date"),
|
||||
nw.lit("medicare").alias("payer"),
|
||||
nw.lit("medicare").alias("payer_type"),
|
||||
nw.lit("medicare").alias("plan"),
|
||||
nw.col("orec").alias("original_reason_entitlement_code"),
|
||||
nw.col("dual_01").alias("dual_status_code"),
|
||||
nw.col("ms_cd").alias("medicare_status_code"),
|
||||
null_str.alias("group_id"),
|
||||
null_str.alias("group_name"),
|
||||
null_str.alias("name_suffix"),
|
||||
nw.col("bene_1st_name").alias("first_name"),
|
||||
nw.col("bene_midl_name").alias("middle_name"),
|
||||
nw.col("bene_last_name").alias("last_name"),
|
||||
null_str.alias("social_security_number"),
|
||||
null_str.alias("subscriber_relation"),
|
||||
nw.col("bene_line_1_adr").alias("address"),
|
||||
nw.col("geo_zip_plc_name").alias("city"),
|
||||
nw.col("geo_usps_state_cd").alias("state"),
|
||||
nw.col("geo_zip5_cd").alias("zip_code"),
|
||||
null_str.alias("phone"),
|
||||
null_str.alias("email"),
|
||||
null_str.alias("ethnicity"),
|
||||
nw.lit("medicare bcda").alias("data_source"),
|
||||
nw.lit(None).cast(nw.String).alias("file_name"),
|
||||
nw.lit(None).cast(nw.Date).alias("file_date"),
|
||||
nw.lit(None).cast(nw.Datetime).alias("ingest_datetime"),
|
||||
nw.lit(None).cast(nw.Int64).alias("hospice_flag"),
|
||||
nw.lit(None).cast(nw.Int64).alias("institutional_snp_flag"),
|
||||
nw.lit(None).cast(nw.Int64).alias("long_term_institutional_flag"),
|
||||
null_str.alias("enrollment_status"),
|
||||
)
|
||||
1078
src/bcda/express/flatten.py
Normal file
1078
src/bcda/express/flatten.py
Normal file
File diff suppressed because it is too large
Load Diff
153
src/bcda/log.py
Normal file
153
src/bcda/log.py
Normal file
@@ -0,0 +1,153 @@
|
||||
"""JSONL structured logging for the bcda namespace.
|
||||
|
||||
Provides a standard-library ``logging.Handler`` that writes each log
|
||||
record as a single JSON line. Captures the full detail of every
|
||||
operation — timestamps, levels, logger names, messages, and any
|
||||
structured ``extra`` fields passed by callers.
|
||||
|
||||
Usage::
|
||||
|
||||
from bcda.log import setup
|
||||
|
||||
# Attach JSONL handler to the 'bcda' logger hierarchy.
|
||||
setup("data/bcda/log.jsonl")
|
||||
|
||||
# All bcda.client / bcda.store logs now land in that file:
|
||||
# {"ts": "2026-02-09T14:30:00.123456", "level": "INFO", ...}
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
# Keys that belong to the stdlib LogRecord internals and should
|
||||
# not leak into the structured JSONL output.
|
||||
_BUILTIN_ATTRS = frozenset(
|
||||
{
|
||||
"args",
|
||||
"created",
|
||||
"exc_info",
|
||||
"exc_text",
|
||||
"filename",
|
||||
"funcName",
|
||||
"levelname",
|
||||
"levelno",
|
||||
"lineno",
|
||||
"module",
|
||||
"msecs",
|
||||
"message",
|
||||
"msg",
|
||||
"name",
|
||||
"pathname",
|
||||
"process",
|
||||
"processName",
|
||||
"relativeCreated",
|
||||
"stack_info",
|
||||
"taskName",
|
||||
"thread",
|
||||
"threadName",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class JsonlHandler(logging.Handler):
|
||||
"""Write log records as JSON lines to an append-only file.
|
||||
|
||||
Each line is a self-contained JSON object with at least::
|
||||
|
||||
{"ts": "...", "level": "INFO", "logger": "bcda.client",
|
||||
"message": "Downloading Patient -> ..."}
|
||||
|
||||
Any ``extra`` dict keys passed via the logging call are merged
|
||||
into the object, giving callers a clean way to attach structured
|
||||
context (``job_key``, ``resource_type``, ``bytes``, etc.).
|
||||
|
||||
Parameters
|
||||
----------
|
||||
path : str or Path
|
||||
Destination JSONL file. Created (with parents) if missing.
|
||||
Opened in append mode so the file grows indefinitely.
|
||||
"""
|
||||
|
||||
def __init__(self, path: str | Path) -> None:
|
||||
super().__init__()
|
||||
self._path = Path(path)
|
||||
self._path.parent.mkdir(parents=True, exist_ok=True)
|
||||
self._file = open(self._path, "a", encoding="utf-8") # noqa: SIM115
|
||||
|
||||
def emit(self, record: logging.LogRecord) -> None:
|
||||
try:
|
||||
entry: dict = {
|
||||
"ts": datetime.fromtimestamp(
|
||||
record.created,
|
||||
tz=timezone.utc,
|
||||
).isoformat(),
|
||||
"level": record.levelname,
|
||||
"logger": record.name,
|
||||
"message": record.getMessage(),
|
||||
}
|
||||
|
||||
# Merge caller-supplied extras (skip stdlib internals).
|
||||
for key, value in record.__dict__.items():
|
||||
if key in _BUILTIN_ATTRS or key.startswith("_"):
|
||||
continue
|
||||
if key in entry:
|
||||
continue
|
||||
try:
|
||||
json.dumps(value)
|
||||
entry[key] = value
|
||||
except (TypeError, ValueError):
|
||||
entry[key] = repr(value)
|
||||
|
||||
if record.exc_info and record.exc_info[1] is not None:
|
||||
entry["exception"] = self.format(record).split("\n")
|
||||
|
||||
self._file.write(json.dumps(entry, default=str) + "\n")
|
||||
self._file.flush()
|
||||
except Exception:
|
||||
self.handleError(record)
|
||||
|
||||
def close(self) -> None:
|
||||
try:
|
||||
self._file.flush()
|
||||
self._file.close()
|
||||
except Exception:
|
||||
pass
|
||||
super().close()
|
||||
|
||||
|
||||
def setup(
|
||||
path: str | Path = "data/bcda/log.jsonl",
|
||||
*,
|
||||
level: int = logging.DEBUG,
|
||||
) -> logging.Logger:
|
||||
"""Attach a :class:`JsonlHandler` to the ``bcda`` logger.
|
||||
|
||||
Returns the ``bcda`` root logger so callers can further
|
||||
configure it if needed. Safe to call multiple times — a
|
||||
second call with the same path is a no-op.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
path : str or Path
|
||||
JSONL destination file.
|
||||
level : int
|
||||
Minimum level to capture. Defaults to ``DEBUG``.
|
||||
"""
|
||||
logger = logging.getLogger("bcda")
|
||||
|
||||
# Avoid duplicate handlers for the same file.
|
||||
resolved = str(Path(path).resolve())
|
||||
for h in logger.handlers:
|
||||
if isinstance(h, JsonlHandler) and str(h._path.resolve()) == resolved:
|
||||
return logger
|
||||
|
||||
handler = JsonlHandler(path)
|
||||
handler.setLevel(level)
|
||||
logger.addHandler(handler)
|
||||
if logger.level == logging.NOTSET or logger.level > level:
|
||||
logger.setLevel(level)
|
||||
return logger
|
||||
0
src/bcda/pipe/__init__.py
Normal file
0
src/bcda/pipe/__init__.py
Normal file
BIN
src/bcda/pipe/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
src/bcda/pipe/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/pipe/__pycache__/cclf.cpython-313.pyc
Normal file
BIN
src/bcda/pipe/__pycache__/cclf.cpython-313.pyc
Normal file
Binary file not shown.
222
src/bcda/pipe/cclf.py
Normal file
222
src/bcda/pipe/cclf.py
Normal file
@@ -0,0 +1,222 @@
|
||||
"""BCDA FHIR R4 connector pipeline — EOB + Patient + Coverage → input_layer.
|
||||
|
||||
Transforms flattened BCDA FHIR R4 resources into three consolidated
|
||||
output tables:
|
||||
- input_layer.medical_claim (Part A + Part B carrier + Part B DME)
|
||||
- input_layer.pharmacy_claim (Part D)
|
||||
- input_layer.eligibility (Patient + Coverage)
|
||||
|
||||
Pipeline expressions (12 total)::
|
||||
|
||||
stg_beneficiary_xref Patient → MBI identity
|
||||
stg_part_a_header EOB(V) + xref
|
||||
int_institutional_medical_claim header + items → medical_claim
|
||||
stg_part_b_physician_header EOB(O) + xref
|
||||
int_physician_medical_claim header + items → medical_claim
|
||||
stg_part_b_dme_header EOB(M) + xref
|
||||
int_dme_medical_claim header + items → medical_claim
|
||||
medical_claim union inst+phys+dme
|
||||
stg_part_d_header EOB(P) + xref
|
||||
pharmacy_claim Part D → pharmacy_claim
|
||||
stg_beneficiary_demographics Patient + Coverage
|
||||
eligibility demographics → eligibility
|
||||
|
||||
Source data — BCDA v2 bulk FHIR export:
|
||||
- ExplanationOfBenefit (header + items)
|
||||
- Patient
|
||||
- Coverage
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from bcda.express import cclf as ex
|
||||
from bib.tag import Tag
|
||||
|
||||
|
||||
def _build_pipeline():
|
||||
# Import runner first to break the aco.express ↔ aco.pipe cycle.
|
||||
# aco.express.base imports aco.pipe.runner at module level, which
|
||||
# triggers aco.pipe.__init__ → aco.pipe.ahrq_measures →
|
||||
# aco.express.base (circular). Pre-importing the runner module
|
||||
# ensures aco.pipe.runner is cached before the chain starts.
|
||||
import aco.pipe.runner # noqa: F401
|
||||
from aco.express.base import Expr
|
||||
from aco.pipe.base import Pipeline
|
||||
|
||||
_REFS = [
|
||||
Tag.module("bcda"),
|
||||
Tag.source("cms-bcda-fhir"),
|
||||
]
|
||||
|
||||
return Pipeline(
|
||||
exprs=[
|
||||
# -- MBI identity -----------------------------------------
|
||||
Expr(
|
||||
name="bcda._stg_beneficiary_xref",
|
||||
fn=ex.stg_beneficiary_xref,
|
||||
after=["bcda.patient"],
|
||||
refs=_REFS,
|
||||
description=(
|
||||
"Deduplicates BCDA Patient to one row per "
|
||||
"beneficiary with the current MBI. Unlike the "
|
||||
"CCLF pipeline, no CCLF9-style crosswalk is "
|
||||
"needed — BCDA delivers current MBIs directly."
|
||||
),
|
||||
),
|
||||
# -- Part A institutional claims --------------------------
|
||||
Expr(
|
||||
name="bcda._stg_part_a_header",
|
||||
fn=ex.stg_part_a_header,
|
||||
after=[
|
||||
"bcda.explanation_of_benefit",
|
||||
"bcda._stg_beneficiary_xref",
|
||||
],
|
||||
refs=_REFS,
|
||||
description=(
|
||||
"Filters EOB to Part A institutional claims "
|
||||
"(nch_near_line_rec_ident_cd='V') and resolves "
|
||||
"beneficiary MBI via the xref."
|
||||
),
|
||||
),
|
||||
Expr(
|
||||
name="bcda._int_institutional_medical_claim",
|
||||
fn=ex.int_institutional_medical_claim,
|
||||
after=["bcda._stg_part_a_header", "bcda.eob_item"],
|
||||
refs=_REFS,
|
||||
description=(
|
||||
"Joins Part A header + line items into "
|
||||
"institutional medical_claim rows with bill type, "
|
||||
"DRG, revenue center, 12 inline diagnosis codes, "
|
||||
"and 1 procedure code from the EOB header."
|
||||
),
|
||||
),
|
||||
# -- Part B physician claims ------------------------------
|
||||
Expr(
|
||||
name="bcda._stg_part_b_physician_header",
|
||||
fn=ex.stg_part_b_physician_header,
|
||||
after=[
|
||||
"bcda.explanation_of_benefit",
|
||||
"bcda._stg_beneficiary_xref",
|
||||
],
|
||||
refs=_REFS,
|
||||
description=(
|
||||
"Filters EOB to Part B carrier/physician claims "
|
||||
"(nch_near_line_rec_ident_cd='O') and resolves "
|
||||
"beneficiary MBI."
|
||||
),
|
||||
),
|
||||
Expr(
|
||||
name="bcda._int_physician_medical_claim",
|
||||
fn=ex.int_physician_medical_claim,
|
||||
after=[
|
||||
"bcda._stg_part_b_physician_header",
|
||||
"bcda.eob_item",
|
||||
],
|
||||
refs=_REFS,
|
||||
description=(
|
||||
"Joins Part B physician header + line items into "
|
||||
"professional medical_claim rows with place of "
|
||||
"service, rendering NPI/TIN, and 12 inline "
|
||||
"diagnosis codes."
|
||||
),
|
||||
),
|
||||
# -- Part B DME claims ------------------------------------
|
||||
Expr(
|
||||
name="bcda._stg_part_b_dme_header",
|
||||
fn=ex.stg_part_b_dme_header,
|
||||
after=[
|
||||
"bcda.explanation_of_benefit",
|
||||
"bcda._stg_beneficiary_xref",
|
||||
],
|
||||
refs=_REFS,
|
||||
description=(
|
||||
"Filters EOB to Part B DME claims "
|
||||
"(nch_near_line_rec_ident_cd='M') and resolves "
|
||||
"beneficiary MBI."
|
||||
),
|
||||
),
|
||||
Expr(
|
||||
name="bcda._int_dme_medical_claim",
|
||||
fn=ex.int_dme_medical_claim,
|
||||
after=["bcda._stg_part_b_dme_header", "bcda.eob_item"],
|
||||
refs=_REFS,
|
||||
description=(
|
||||
"Joins Part B DME header + line items into "
|
||||
"professional medical_claim rows. DME claims "
|
||||
"carry no diagnosis or procedure codes."
|
||||
),
|
||||
),
|
||||
# -- Final medical_claim (union) --------------------------
|
||||
Expr(
|
||||
name="bcda.medical_claim",
|
||||
fn=ex.medical_claim,
|
||||
after=[
|
||||
"bcda._int_institutional_medical_claim",
|
||||
"bcda._int_physician_medical_claim",
|
||||
"bcda._int_dme_medical_claim",
|
||||
],
|
||||
refs=_REFS,
|
||||
description=(
|
||||
"Unions institutional + professional + DME into "
|
||||
"the final medical_claim table."
|
||||
),
|
||||
),
|
||||
# -- Part D pharmacy claims -------------------------------
|
||||
Expr(
|
||||
name="bcda._stg_part_d_header",
|
||||
fn=ex.stg_part_d_header,
|
||||
after=[
|
||||
"bcda.explanation_of_benefit",
|
||||
"bcda._stg_beneficiary_xref",
|
||||
],
|
||||
refs=_REFS,
|
||||
description=(
|
||||
"Filters EOB to Part D pharmacy claims "
|
||||
"(nch_near_line_rec_ident_cd='P') and resolves "
|
||||
"beneficiary MBI."
|
||||
),
|
||||
),
|
||||
Expr(
|
||||
name="bcda.pharmacy_claim",
|
||||
fn=ex.pharmacy_claim,
|
||||
after=["bcda._stg_part_d_header", "bcda.eob_item"],
|
||||
refs=_REFS,
|
||||
description=(
|
||||
"Joins Part D header + line items into "
|
||||
"pharmacy_claim with NDC, quantity, days supply, "
|
||||
"prescribing and dispensing provider NPIs."
|
||||
),
|
||||
),
|
||||
# -- Eligibility ------------------------------------------
|
||||
Expr(
|
||||
name="bcda._stg_beneficiary_demographics",
|
||||
fn=ex.stg_beneficiary_demographics,
|
||||
after=["bcda.patient", "bcda.coverage"],
|
||||
refs=_REFS,
|
||||
description=(
|
||||
"Joins Patient + Coverage for demographics and "
|
||||
"enrollment data. Deduplicates to one row per "
|
||||
"beneficiary MBI."
|
||||
),
|
||||
),
|
||||
Expr(
|
||||
name="bcda.eligibility",
|
||||
fn=ex.eligibility,
|
||||
after=["bcda._stg_beneficiary_demographics"],
|
||||
refs=_REFS,
|
||||
description=(
|
||||
"Maps Patient + Coverage to the eligibility "
|
||||
"schema with gender and race crosswalks."
|
||||
),
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def __getattr__(name):
|
||||
if name in ("pipeline", "run"):
|
||||
p = _build_pipeline()
|
||||
globals()["pipeline"] = p
|
||||
globals()["run"] = p.run
|
||||
return globals()[name]
|
||||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||
561
src/bcda/store.py
Normal file
561
src/bcda/store.py
Normal file
@@ -0,0 +1,561 @@
|
||||
"""Persistent storage and state management for BCDA exports.
|
||||
|
||||
Wraps :class:`bcda.client.Client` with append-only Parquet state
|
||||
tracking and configurable file storage (local, network, S3, Azure).
|
||||
|
||||
State is kept in two ever-growing Parquet files — ``jobs.parquet``
|
||||
and ``files.parquet`` — where each mutation appends a new row.
|
||||
The current state of any job or file is the **last row** for its
|
||||
key, giving a full audit trail for free.
|
||||
|
||||
Storage backends are selected by the ``path`` prefix:
|
||||
|
||||
- Local / network mount: ``"data/bcda"`` or ``"/mnt/share/bcda"``
|
||||
- S3: ``"s3://bucket/prefix"``
|
||||
- Azure Blob: ``"az://container/prefix"``
|
||||
|
||||
All backends use ``fsspec`` under the hood. S3 and Azure require
|
||||
the appropriate extra (``s3fs``, ``adlfs``) installed by the user.
|
||||
|
||||
Usage::
|
||||
|
||||
from bcda.client import Client
|
||||
from bcda.store import Store
|
||||
|
||||
store = Store("data/bcda")
|
||||
|
||||
with Client(client_id="...", client_secret="...") as c:
|
||||
key = store.export(c, types=["Patient", "Coverage"])
|
||||
|
||||
# Resume after interruption
|
||||
with Client(client_id="...", client_secret="...") as c:
|
||||
store.resume(c, key)
|
||||
|
||||
# Inspect state
|
||||
store.get_job(key)
|
||||
store.get_files(key)
|
||||
store.list_jobs(status="failed")
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import random
|
||||
import string
|
||||
import tempfile
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import fsspec
|
||||
import pyarrow as pa
|
||||
import pyarrow.parquet as pq
|
||||
|
||||
from bcda.client import Client
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
# ── Parquet schemas ──────────────────────────────────────────
|
||||
|
||||
JOBS_SCHEMA = pa.schema(
|
||||
[
|
||||
("ts", pa.timestamp("us", tz="UTC")),
|
||||
("key", pa.string()),
|
||||
("job_url", pa.string()),
|
||||
("endpoint", pa.string()),
|
||||
("types", pa.string()),
|
||||
("since", pa.string()),
|
||||
("status", pa.string()),
|
||||
("error", pa.string()),
|
||||
]
|
||||
)
|
||||
|
||||
FILES_SCHEMA = pa.schema(
|
||||
[
|
||||
("ts", pa.timestamp("us", tz="UTC")),
|
||||
("job_key", pa.string()),
|
||||
("resource_type", pa.string()),
|
||||
("url", pa.string()),
|
||||
("storage_path", pa.string()),
|
||||
("file_size", pa.int64()),
|
||||
("status", pa.string()),
|
||||
("error", pa.string()),
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def _now() -> datetime:
|
||||
return datetime.now(tz=timezone.utc)
|
||||
|
||||
|
||||
def _generate_key() -> str:
|
||||
chars = string.ascii_uppercase + string.digits
|
||||
return "".join(random.choices(chars, k=8)) # noqa: S311
|
||||
|
||||
|
||||
def _current_state(table: pa.Table, key_col: str) -> pa.Table:
|
||||
"""Deduplicate an append-only table, keeping the last row per key."""
|
||||
if table.num_rows == 0:
|
||||
return table
|
||||
# Sort by ts ascending so the last occurrence per key wins.
|
||||
indices = pa.compute.sort_indices(table, sort_keys=[("ts", "ascending")])
|
||||
table = table.take(indices)
|
||||
# Walk backwards, keeping only the first occurrence of each key.
|
||||
keys = table.column(key_col)
|
||||
seen: set[str] = set()
|
||||
keep: list[int] = []
|
||||
for i in range(table.num_rows - 1, -1, -1):
|
||||
k = keys[i].as_py()
|
||||
if k not in seen:
|
||||
seen.add(k)
|
||||
keep.append(i)
|
||||
keep.reverse()
|
||||
return table.take(keep)
|
||||
|
||||
|
||||
class Store:
|
||||
"""Persistent BCDA export storage and state manager.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
path : str or Path
|
||||
Root location for state files, logs, and ndjson exports.
|
||||
Accepts local paths, network mounts, or URIs for S3
|
||||
(``s3://...``) and Azure (``az://...``).
|
||||
storage_options : dict
|
||||
Extra arguments forwarded to ``fsspec.filesystem()`` —
|
||||
typically credentials for cloud backends.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
path: str | Path = "data/bcda",
|
||||
storage_options: dict[str, Any] | None = None,
|
||||
) -> None:
|
||||
self._root = str(path).rstrip("/")
|
||||
self._storage_options = storage_options or {}
|
||||
self._filesystem: fsspec.AbstractFileSystem | None = None
|
||||
|
||||
# ── Filesystem ───────────────────────────────────────────
|
||||
|
||||
def _fs(self) -> fsspec.AbstractFileSystem:
|
||||
"""Return (and cache) the fsspec filesystem for ``self._root``."""
|
||||
if self._filesystem is None:
|
||||
self._filesystem, _ = fsspec.core.url_to_fs(
|
||||
self._root,
|
||||
**self._storage_options,
|
||||
)
|
||||
return self._filesystem
|
||||
|
||||
def _full(self, *parts: str) -> str:
|
||||
"""Join parts onto the root path."""
|
||||
return "/".join([self._root, *parts])
|
||||
|
||||
def _ensure_dir(self, path: str) -> None:
|
||||
self._fs().mkdirs(path, exist_ok=True)
|
||||
|
||||
# ── Parquet state I/O ────────────────────────────────────
|
||||
|
||||
@property
|
||||
def _jobs_path(self) -> str:
|
||||
return self._full("jobs.parquet")
|
||||
|
||||
@property
|
||||
def _files_path(self) -> str:
|
||||
return self._full("files.parquet")
|
||||
|
||||
def _read_parquet(self, path: str, schema: pa.Schema) -> pa.Table:
|
||||
"""Read a parquet file; return empty table if it doesn't exist."""
|
||||
fs = self._fs()
|
||||
if not fs.exists(path):
|
||||
return schema.empty_table()
|
||||
with fs.open(path, "rb") as f:
|
||||
return pq.read_table(f, schema=schema)
|
||||
|
||||
def _append_parquet(
|
||||
self,
|
||||
path: str,
|
||||
schema: pa.Schema,
|
||||
rows: list[dict],
|
||||
) -> None:
|
||||
"""Append rows to an ever-growing parquet file."""
|
||||
existing = self._read_parquet(path, schema)
|
||||
new = pa.Table.from_pylist(rows, schema=schema)
|
||||
combined = pa.concat_tables([existing, new])
|
||||
self._ensure_dir(self._root)
|
||||
fs = self._fs()
|
||||
with fs.open(path, "wb") as f:
|
||||
pq.write_table(combined, f)
|
||||
|
||||
def _append_job(self, **fields: Any) -> None:
|
||||
fields.setdefault("ts", _now())
|
||||
for col in JOBS_SCHEMA.names:
|
||||
fields.setdefault(col, "")
|
||||
self._append_parquet(self._jobs_path, JOBS_SCHEMA, [fields])
|
||||
|
||||
def _append_file(self, **fields: Any) -> None:
|
||||
fields.setdefault("ts", _now())
|
||||
fields.setdefault("file_size", 0)
|
||||
for col in FILES_SCHEMA.names:
|
||||
fields.setdefault(col, "")
|
||||
self._append_parquet(self._files_path, FILES_SCHEMA, [fields])
|
||||
|
||||
# ── Query state ──────────────────────────────────────────
|
||||
|
||||
def get_job(self, key: str) -> dict:
|
||||
"""Get the current state of a job by its key.
|
||||
|
||||
Raises ``KeyError`` if no job with that key exists.
|
||||
"""
|
||||
table = self._read_parquet(self._jobs_path, JOBS_SCHEMA)
|
||||
current = _current_state(table, "key")
|
||||
for row in current.to_pylist():
|
||||
if row["key"] == key:
|
||||
return row
|
||||
raise KeyError(f"Job not found: {key}")
|
||||
|
||||
def list_jobs(self, *, status: str | None = None) -> list[dict]:
|
||||
"""List all jobs, optionally filtered by status."""
|
||||
table = self._read_parquet(self._jobs_path, JOBS_SCHEMA)
|
||||
current = _current_state(table, "key")
|
||||
rows = current.to_pylist()
|
||||
if status:
|
||||
rows = [r for r in rows if r["status"] == status]
|
||||
return rows
|
||||
|
||||
def get_files(self, job_key: str) -> list[dict]:
|
||||
"""Get current state of all files for a job."""
|
||||
table = self._read_parquet(self._files_path, FILES_SCHEMA)
|
||||
current = _current_state(table, "url")
|
||||
return [r for r in current.to_pylist() if r["job_key"] == job_key]
|
||||
|
||||
# ── File storage ─────────────────────────────────────────
|
||||
|
||||
def _store_file(
|
||||
self,
|
||||
local_path: Path,
|
||||
job_key: str,
|
||||
filename: str,
|
||||
) -> str:
|
||||
"""Copy a local file into the storage backend.
|
||||
|
||||
Returns the storage path.
|
||||
"""
|
||||
dest = self._full("exports", job_key, filename)
|
||||
self._ensure_dir(self._full("exports", job_key))
|
||||
fs = self._fs()
|
||||
fs.put_file(str(local_path), dest)
|
||||
return dest
|
||||
|
||||
def open(self, storage_path: str, mode: str = "rb"):
|
||||
"""Open a file from the storage backend."""
|
||||
return self._fs().open(storage_path, mode)
|
||||
|
||||
# ── Export with state tracking ───────────────────────────
|
||||
|
||||
def export(
|
||||
self,
|
||||
client: Client,
|
||||
*,
|
||||
endpoint: str = "Group/all",
|
||||
types: list[str] | None = None,
|
||||
since: str | None = None,
|
||||
poll_interval: float = 10.0,
|
||||
) -> str:
|
||||
"""Run a full export with persistent state tracking.
|
||||
|
||||
Wraps :meth:`Client.start_export`, :meth:`Client.poll`,
|
||||
and file downloads, recording every state transition to
|
||||
Parquet. Returns the job key.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
client : Client
|
||||
An authenticated BCDA client instance.
|
||||
endpoint : str
|
||||
``"Group/all"`` (default), ``"Group/runout"``, or
|
||||
``"Patient"``.
|
||||
types : list[str] | None
|
||||
FHIR resource types to request.
|
||||
since : str | None
|
||||
``_since`` timestamp filter.
|
||||
poll_interval : float
|
||||
Seconds between status polls.
|
||||
"""
|
||||
key = _generate_key()
|
||||
types_str = ",".join(types) if types else ""
|
||||
log.info("Starting export %s", key, extra={"job_key": key})
|
||||
|
||||
# 1. Record pending.
|
||||
self._append_job(
|
||||
key=key,
|
||||
endpoint=endpoint,
|
||||
types=types_str,
|
||||
since=since or "",
|
||||
status="pending",
|
||||
)
|
||||
|
||||
try:
|
||||
# 2. Start export.
|
||||
job_url = client.start_export(
|
||||
endpoint=endpoint,
|
||||
types=types,
|
||||
since=since,
|
||||
)
|
||||
self._append_job(
|
||||
key=key,
|
||||
job_url=job_url,
|
||||
endpoint=endpoint,
|
||||
types=types_str,
|
||||
since=since or "",
|
||||
status="polling",
|
||||
)
|
||||
|
||||
# 3. Poll until complete.
|
||||
result = client.poll(job_url, interval=poll_interval)
|
||||
self._append_job(
|
||||
key=key,
|
||||
job_url=job_url,
|
||||
endpoint=endpoint,
|
||||
types=types_str,
|
||||
since=since or "",
|
||||
status="complete",
|
||||
)
|
||||
|
||||
# 4. Download files.
|
||||
self._download_outputs(client, key, result)
|
||||
|
||||
except Exception as exc:
|
||||
log.error(
|
||||
"Export %s failed: %s",
|
||||
key,
|
||||
exc,
|
||||
extra={"job_key": key},
|
||||
)
|
||||
self._append_job(
|
||||
key=key,
|
||||
endpoint=endpoint,
|
||||
types=types_str,
|
||||
since=since or "",
|
||||
status="failed",
|
||||
error=str(exc),
|
||||
)
|
||||
raise
|
||||
|
||||
log.info("Export %s finished", key, extra={"job_key": key})
|
||||
return key
|
||||
|
||||
def _download_outputs(
|
||||
self,
|
||||
client: Client,
|
||||
job_key: str,
|
||||
result: dict,
|
||||
) -> None:
|
||||
"""Download all output files from a completed job result."""
|
||||
outputs = result.get("output", [])
|
||||
type_counts: dict[str, int] = {}
|
||||
|
||||
for entry in outputs:
|
||||
url = entry["url"]
|
||||
resource_type = entry.get("type", "unknown")
|
||||
|
||||
count = type_counts.get(resource_type, 0)
|
||||
type_counts[resource_type] = count + 1
|
||||
if count == 0:
|
||||
filename = f"{resource_type}.ndjson"
|
||||
else:
|
||||
filename = f"{resource_type}.{count}.ndjson"
|
||||
|
||||
# Record pending.
|
||||
self._append_file(
|
||||
job_key=job_key,
|
||||
resource_type=resource_type,
|
||||
url=url,
|
||||
status="pending",
|
||||
)
|
||||
|
||||
try:
|
||||
self._append_file(
|
||||
job_key=job_key,
|
||||
resource_type=resource_type,
|
||||
url=url,
|
||||
status="downloading",
|
||||
)
|
||||
|
||||
# Download to temp, then move to storage.
|
||||
with tempfile.NamedTemporaryFile(
|
||||
suffix=".ndjson",
|
||||
delete=False,
|
||||
) as tmp:
|
||||
tmp_path = Path(tmp.name)
|
||||
|
||||
client._download_file(url, tmp_path)
|
||||
file_size = tmp_path.stat().st_size
|
||||
storage_path = self._store_file(
|
||||
tmp_path,
|
||||
job_key,
|
||||
filename,
|
||||
)
|
||||
tmp_path.unlink(missing_ok=True)
|
||||
|
||||
self._append_file(
|
||||
job_key=job_key,
|
||||
resource_type=resource_type,
|
||||
url=url,
|
||||
storage_path=storage_path,
|
||||
file_size=file_size,
|
||||
status="complete",
|
||||
)
|
||||
log.info(
|
||||
"Stored %s (%d bytes)",
|
||||
filename,
|
||||
file_size,
|
||||
extra={
|
||||
"job_key": job_key,
|
||||
"resource_type": resource_type,
|
||||
"file_size": file_size,
|
||||
},
|
||||
)
|
||||
|
||||
except Exception as exc:
|
||||
tmp_path.unlink(missing_ok=True)
|
||||
self._append_file(
|
||||
job_key=job_key,
|
||||
resource_type=resource_type,
|
||||
url=url,
|
||||
status="failed",
|
||||
error=str(exc),
|
||||
)
|
||||
log.error(
|
||||
"Download failed for %s: %s",
|
||||
resource_type,
|
||||
exc,
|
||||
extra={
|
||||
"job_key": job_key,
|
||||
"resource_type": resource_type,
|
||||
},
|
||||
)
|
||||
raise
|
||||
|
||||
# ── Resume / retry ───────────────────────────────────────
|
||||
|
||||
def resume(
|
||||
self,
|
||||
client: Client,
|
||||
key: str,
|
||||
*,
|
||||
poll_interval: float = 10.0,
|
||||
) -> str:
|
||||
"""Resume an incomplete export from its last known state.
|
||||
|
||||
Picks up where the process left off:
|
||||
|
||||
- ``pending`` → start the export from scratch.
|
||||
- ``polling`` → re-poll the saved ``job_url``.
|
||||
- ``complete`` → download any files not yet complete.
|
||||
- ``failed`` → retry from the failure point.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
client : Client
|
||||
An authenticated BCDA client instance.
|
||||
key : str
|
||||
The job key returned by :meth:`export`.
|
||||
poll_interval : float
|
||||
Seconds between status polls.
|
||||
"""
|
||||
job = self.get_job(key)
|
||||
status = job["status"]
|
||||
log.info(
|
||||
"Resuming export %s (status=%s)",
|
||||
key,
|
||||
status,
|
||||
extra={"job_key": key},
|
||||
)
|
||||
|
||||
if status == "pending":
|
||||
# Never got as far as start_export; re-run.
|
||||
types = job["types"].split(",") if job["types"] else None
|
||||
since = job["since"] or None
|
||||
job_url = client.start_export(
|
||||
endpoint=job["endpoint"],
|
||||
types=types,
|
||||
since=since,
|
||||
)
|
||||
self._append_job(
|
||||
key=key,
|
||||
job_url=job_url,
|
||||
endpoint=job["endpoint"],
|
||||
types=job["types"],
|
||||
since=job["since"],
|
||||
status="polling",
|
||||
)
|
||||
job["job_url"] = job_url
|
||||
status = "polling"
|
||||
|
||||
if status in ("polling", "failed"):
|
||||
job_url = job.get("job_url") or job.get("job_url", "")
|
||||
if not job_url:
|
||||
raise ValueError(f"Job {key} has no job_url — cannot resume polling.")
|
||||
try:
|
||||
result = client.poll(job_url, interval=poll_interval)
|
||||
self._append_job(
|
||||
key=key,
|
||||
job_url=job_url,
|
||||
endpoint=job["endpoint"],
|
||||
types=job["types"],
|
||||
since=job["since"],
|
||||
status="complete",
|
||||
)
|
||||
status = "complete"
|
||||
except Exception as exc:
|
||||
self._append_job(
|
||||
key=key,
|
||||
job_url=job_url,
|
||||
endpoint=job["endpoint"],
|
||||
types=job["types"],
|
||||
since=job["since"],
|
||||
status="failed",
|
||||
error=str(exc),
|
||||
)
|
||||
raise
|
||||
|
||||
if status == "complete":
|
||||
# Check which files still need downloading.
|
||||
files = self.get_files(key)
|
||||
completed_urls = {f["url"] for f in files if f["status"] == "complete"}
|
||||
|
||||
# We need the job result to know what outputs exist.
|
||||
# If we just polled, we have it; otherwise re-poll
|
||||
# (a completed job returns 200 immediately).
|
||||
if "result" not in dir():
|
||||
result = client.poll(
|
||||
job["job_url"],
|
||||
interval=poll_interval,
|
||||
)
|
||||
|
||||
pending = [
|
||||
e for e in result.get("output", []) if e["url"] not in completed_urls
|
||||
]
|
||||
|
||||
if pending:
|
||||
log.info(
|
||||
"Resuming %d pending file(s) for %s",
|
||||
len(pending),
|
||||
key,
|
||||
extra={"job_key": key},
|
||||
)
|
||||
# Build a partial result for _download_outputs.
|
||||
self._download_outputs(
|
||||
client,
|
||||
key,
|
||||
{"output": pending},
|
||||
)
|
||||
else:
|
||||
log.info(
|
||||
"All files already complete for %s",
|
||||
key,
|
||||
extra={"job_key": key},
|
||||
)
|
||||
|
||||
return key
|
||||
13
src/bcda/table/__init__.py
Normal file
13
src/bcda/table/__init__.py
Normal file
@@ -0,0 +1,13 @@
|
||||
"""BCDA Pydantic table models for all CMS FHIR R4 data entities."""
|
||||
|
||||
# Adjudicated claims — FHIR R4 resources
|
||||
from .coverage import Coverage as Coverage
|
||||
from .eob import EobItem as EobItem
|
||||
from .eob import ExplanationOfBenefit as ExplanationOfBenefit
|
||||
|
||||
# Partially adjudicated claims — FISS (institutional) / MCS (professional)
|
||||
from .fiss import FissClaim as FissClaim
|
||||
from .fiss import FissClaimResponse as FissClaimResponse
|
||||
from .mcs import McsClaim as McsClaim
|
||||
from .mcs import McsClaimResponse as McsClaimResponse
|
||||
from .patient import Patient as Patient
|
||||
BIN
src/bcda/table/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/bene_demographics.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/bene_demographics.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/bene_xref.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/bene_xref.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/coverage.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/coverage.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/eob.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/eob.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/fiss.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/fiss.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/mcs.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/mcs.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/part_a_ben_demo.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/part_a_ben_demo.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/part_a_diagnosis.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/part_a_diagnosis.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/part_a_header.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/part_a_header.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/part_a_procedure.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/part_a_procedure.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/part_a_revenue.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/part_a_revenue.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/part_b_ben_demo.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/part_b_ben_demo.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/part_b_dme.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/part_b_dme.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/part_b_physicians.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/part_b_physicians.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/part_d.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/part_d.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bcda/table/__pycache__/patient.cpython-313.pyc
Normal file
BIN
src/bcda/table/__pycache__/patient.cpython-313.pyc
Normal file
Binary file not shown.
565
src/bcda/table/coverage.py
Normal file
565
src/bcda/table/coverage.py
Normal file
@@ -0,0 +1,565 @@
|
||||
"""FHIR R4 Coverage resource — beneficiary enrollment and entitlement.
|
||||
|
||||
Flattened from the BCDA v2 Coverage ndjson export. Each beneficiary
|
||||
may have multiple Coverage records (Part A, Part B, Part D).
|
||||
|
||||
The Coverage resource carries enrollment status, dual eligibility,
|
||||
entitlement/termination codes, and extensive monthly indicator
|
||||
extensions for buy-in, HMO, cost sharing, Part C/D contracts, and
|
||||
Retiree Drug Subsidy. Each monthly series has 12 fields (01–12)
|
||||
representing January through December of the reference year.
|
||||
|
||||
Source: ``/api/v2/Coverage/$export`` bulk FHIR endpoint.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import date
|
||||
|
||||
from aco.table.base import SQLTable
|
||||
|
||||
|
||||
class Coverage(SQLTable):
|
||||
"""FHIR R4 Coverage resource — Medicare enrollment."""
|
||||
|
||||
__schema__ = "bcda"
|
||||
__tablename__ = "coverage"
|
||||
|
||||
# ── Resource metadata ────────────────────────────────────
|
||||
id: str | None = None
|
||||
"""FHIR resource ID (Coverage.id)."""
|
||||
|
||||
last_updated: str | None = None
|
||||
"""Resource last-updated timestamp (Coverage.meta.lastUpdated)."""
|
||||
|
||||
status: str | None = None
|
||||
"""Coverage status — active | cancelled | entered-in-error
|
||||
(Coverage.status)."""
|
||||
|
||||
subscriber_id: str | None = None
|
||||
"""Subscriber identifier — MBI
|
||||
(Coverage.subscriberId)."""
|
||||
|
||||
beneficiary_reference: str | None = None
|
||||
"""Reference to Patient resource
|
||||
(Coverage.beneficiary.reference)."""
|
||||
|
||||
coverage_type: str | None = None
|
||||
"""Coverage type code — Part A, Part B, Part D
|
||||
(Coverage.type.coding.code)."""
|
||||
|
||||
class_group: str | None = None
|
||||
"""Class group value — 'Medicare'
|
||||
(Coverage.class[group].value)."""
|
||||
|
||||
class_plan: str | None = None
|
||||
"""Class plan value — 'Part A', 'Part B', 'Part D'
|
||||
(Coverage.class[plan].value)."""
|
||||
|
||||
rfrnc_yr: str | None = None
|
||||
"""Reference year for monthly indicators
|
||||
(Coverage.extension[rfrnc_yr] valueDate)."""
|
||||
|
||||
# ── Enrollment status (single-value) ─────────────────────
|
||||
ms_cd: str | None = None
|
||||
"""Medicare status code — reason for entitlement
|
||||
(Coverage.extension[ms_cd] valueCoding)."""
|
||||
|
||||
orec: str | None = None
|
||||
"""Original reason for entitlement code
|
||||
(Coverage.extension[orec] valueCoding)."""
|
||||
|
||||
crec: str | None = None
|
||||
"""Current reason for entitlement code
|
||||
(Coverage.extension[crec] valueCoding)."""
|
||||
|
||||
esrd_ind: str | None = None
|
||||
"""End-stage renal disease indicator
|
||||
(Coverage.extension[esrd_ind] valueCoding)."""
|
||||
|
||||
a_trm_cd: str | None = None
|
||||
"""Part A termination code
|
||||
(Coverage.extension[a_trm_cd] valueCoding)."""
|
||||
|
||||
b_trm_cd: str | None = None
|
||||
"""Part B termination code
|
||||
(Coverage.extension[b_trm_cd] valueCoding)."""
|
||||
|
||||
# ── Coverage periods ─────────────────────────────────────
|
||||
bene_part_a_enrlmt_bgn_dt: date | None = None
|
||||
"""Part A enrollment begin date (Coverage.period.start)."""
|
||||
|
||||
bene_part_b_enrlmt_bgn_dt: date | None = None
|
||||
"""Part B enrollment begin date (Coverage.period.start)."""
|
||||
|
||||
mdcr_covg_a_end_dt: date | None = None
|
||||
"""Part A coverage end date (Coverage.period.end).
|
||||
BCDA-only — not in CCLF."""
|
||||
|
||||
mdcr_covg_b_end_dt: date | None = None
|
||||
"""Part B coverage end date (Coverage.period.end).
|
||||
BCDA-only — not in CCLF."""
|
||||
|
||||
mdcr_covg_d_bgn_dt: date | None = None
|
||||
"""Part D coverage start date (Coverage.period.start).
|
||||
BCDA-only — not in CCLF."""
|
||||
|
||||
mdcr_covg_d_end_dt: date | None = None
|
||||
"""Part D coverage end date (Coverage.period.end).
|
||||
BCDA-only — not in CCLF."""
|
||||
|
||||
# ── Monthly buy-in indicators (buyin01–12) ───────────────
|
||||
buyin01: str | None = None
|
||||
"""Medicare entitlement/buy-in — January
|
||||
(Coverage.extension[buyin01] valueCoding)."""
|
||||
|
||||
buyin02: str | None = None
|
||||
"""Medicare entitlement/buy-in — February."""
|
||||
|
||||
buyin03: str | None = None
|
||||
"""Medicare entitlement/buy-in — March."""
|
||||
|
||||
buyin04: str | None = None
|
||||
"""Medicare entitlement/buy-in — April."""
|
||||
|
||||
buyin05: str | None = None
|
||||
"""Medicare entitlement/buy-in — May."""
|
||||
|
||||
buyin06: str | None = None
|
||||
"""Medicare entitlement/buy-in — June."""
|
||||
|
||||
buyin07: str | None = None
|
||||
"""Medicare entitlement/buy-in — July."""
|
||||
|
||||
buyin08: str | None = None
|
||||
"""Medicare entitlement/buy-in — August."""
|
||||
|
||||
buyin09: str | None = None
|
||||
"""Medicare entitlement/buy-in — September."""
|
||||
|
||||
buyin10: str | None = None
|
||||
"""Medicare entitlement/buy-in — October."""
|
||||
|
||||
buyin11: str | None = None
|
||||
"""Medicare entitlement/buy-in — November."""
|
||||
|
||||
buyin12: str | None = None
|
||||
"""Medicare entitlement/buy-in — December."""
|
||||
|
||||
# ── Monthly dual eligibility (dual_01–12) ────────────────
|
||||
dual_01: str | None = None
|
||||
"""Dual eligibility status — January
|
||||
(Coverage.extension[dual_01] valueCoding)."""
|
||||
|
||||
dual_02: str | None = None
|
||||
"""Dual eligibility status — February."""
|
||||
|
||||
dual_03: str | None = None
|
||||
"""Dual eligibility status — March."""
|
||||
|
||||
dual_04: str | None = None
|
||||
"""Dual eligibility status — April."""
|
||||
|
||||
dual_05: str | None = None
|
||||
"""Dual eligibility status — May."""
|
||||
|
||||
dual_06: str | None = None
|
||||
"""Dual eligibility status — June."""
|
||||
|
||||
dual_07: str | None = None
|
||||
"""Dual eligibility status — July."""
|
||||
|
||||
dual_08: str | None = None
|
||||
"""Dual eligibility status — August."""
|
||||
|
||||
dual_09: str | None = None
|
||||
"""Dual eligibility status — September."""
|
||||
|
||||
dual_10: str | None = None
|
||||
"""Dual eligibility status — October."""
|
||||
|
||||
dual_11: str | None = None
|
||||
"""Dual eligibility status — November."""
|
||||
|
||||
dual_12: str | None = None
|
||||
"""Dual eligibility status — December."""
|
||||
|
||||
# ── Monthly HMO indicators (hmo_ind_01–12) ───────────────
|
||||
hmo_ind_01: str | None = None
|
||||
"""HMO indicator — January
|
||||
(Coverage.extension[hmo_ind_01] valueCoding)."""
|
||||
|
||||
hmo_ind_02: str | None = None
|
||||
"""HMO indicator — February."""
|
||||
|
||||
hmo_ind_03: str | None = None
|
||||
"""HMO indicator — March."""
|
||||
|
||||
hmo_ind_04: str | None = None
|
||||
"""HMO indicator — April."""
|
||||
|
||||
hmo_ind_05: str | None = None
|
||||
"""HMO indicator — May."""
|
||||
|
||||
hmo_ind_06: str | None = None
|
||||
"""HMO indicator — June."""
|
||||
|
||||
hmo_ind_07: str | None = None
|
||||
"""HMO indicator — July."""
|
||||
|
||||
hmo_ind_08: str | None = None
|
||||
"""HMO indicator — August."""
|
||||
|
||||
hmo_ind_09: str | None = None
|
||||
"""HMO indicator — September."""
|
||||
|
||||
hmo_ind_10: str | None = None
|
||||
"""HMO indicator — October."""
|
||||
|
||||
hmo_ind_11: str | None = None
|
||||
"""HMO indicator — November."""
|
||||
|
||||
hmo_ind_12: str | None = None
|
||||
"""HMO indicator — December."""
|
||||
|
||||
# ── Monthly cost-share group (cstshr01–12) ───────────────
|
||||
cstshr01: str | None = None
|
||||
"""Low-income cost sharing group — January
|
||||
(Coverage.extension[cstshr01] valueCoding)."""
|
||||
|
||||
cstshr02: str | None = None
|
||||
"""Low-income cost sharing group — February."""
|
||||
|
||||
cstshr03: str | None = None
|
||||
"""Low-income cost sharing group — March."""
|
||||
|
||||
cstshr04: str | None = None
|
||||
"""Low-income cost sharing group — April."""
|
||||
|
||||
cstshr05: str | None = None
|
||||
"""Low-income cost sharing group — May."""
|
||||
|
||||
cstshr06: str | None = None
|
||||
"""Low-income cost sharing group — June."""
|
||||
|
||||
cstshr07: str | None = None
|
||||
"""Low-income cost sharing group — July."""
|
||||
|
||||
cstshr08: str | None = None
|
||||
"""Low-income cost sharing group — August."""
|
||||
|
||||
cstshr09: str | None = None
|
||||
"""Low-income cost sharing group — September."""
|
||||
|
||||
cstshr10: str | None = None
|
||||
"""Low-income cost sharing group — October."""
|
||||
|
||||
cstshr11: str | None = None
|
||||
"""Low-income cost sharing group — November."""
|
||||
|
||||
cstshr12: str | None = None
|
||||
"""Low-income cost sharing group — December."""
|
||||
|
||||
# ── Monthly RDS indicators (rdsind01–12) ─────────────────
|
||||
rdsind01: str | None = None
|
||||
"""Retiree Drug Subsidy indicator — January
|
||||
(Coverage.extension[rdsind01] valueCoding)."""
|
||||
|
||||
rdsind02: str | None = None
|
||||
"""Retiree Drug Subsidy indicator — February."""
|
||||
|
||||
rdsind03: str | None = None
|
||||
"""Retiree Drug Subsidy indicator — March."""
|
||||
|
||||
rdsind04: str | None = None
|
||||
"""Retiree Drug Subsidy indicator — April."""
|
||||
|
||||
rdsind05: str | None = None
|
||||
"""Retiree Drug Subsidy indicator — May."""
|
||||
|
||||
rdsind06: str | None = None
|
||||
"""Retiree Drug Subsidy indicator — June."""
|
||||
|
||||
rdsind07: str | None = None
|
||||
"""Retiree Drug Subsidy indicator — July."""
|
||||
|
||||
rdsind08: str | None = None
|
||||
"""Retiree Drug Subsidy indicator — August."""
|
||||
|
||||
rdsind09: str | None = None
|
||||
"""Retiree Drug Subsidy indicator — September."""
|
||||
|
||||
rdsind10: str | None = None
|
||||
"""Retiree Drug Subsidy indicator — October."""
|
||||
|
||||
rdsind11: str | None = None
|
||||
"""Retiree Drug Subsidy indicator — November."""
|
||||
|
||||
rdsind12: str | None = None
|
||||
"""Retiree Drug Subsidy indicator — December."""
|
||||
|
||||
# ── Part C contract IDs (ptc_cntrct_id_01–12) ────────────
|
||||
ptc_cntrct_id_01: str | None = None
|
||||
"""Part C contract ID — January
|
||||
(Coverage.extension[ptc_cntrct_id_01] valueCoding)."""
|
||||
|
||||
ptc_cntrct_id_02: str | None = None
|
||||
"""Part C contract ID — February."""
|
||||
|
||||
ptc_cntrct_id_03: str | None = None
|
||||
"""Part C contract ID — March."""
|
||||
|
||||
ptc_cntrct_id_04: str | None = None
|
||||
"""Part C contract ID — April."""
|
||||
|
||||
ptc_cntrct_id_05: str | None = None
|
||||
"""Part C contract ID — May."""
|
||||
|
||||
ptc_cntrct_id_06: str | None = None
|
||||
"""Part C contract ID — June."""
|
||||
|
||||
ptc_cntrct_id_07: str | None = None
|
||||
"""Part C contract ID — July."""
|
||||
|
||||
ptc_cntrct_id_08: str | None = None
|
||||
"""Part C contract ID — August."""
|
||||
|
||||
ptc_cntrct_id_09: str | None = None
|
||||
"""Part C contract ID — September."""
|
||||
|
||||
ptc_cntrct_id_10: str | None = None
|
||||
"""Part C contract ID — October."""
|
||||
|
||||
ptc_cntrct_id_11: str | None = None
|
||||
"""Part C contract ID — November."""
|
||||
|
||||
ptc_cntrct_id_12: str | None = None
|
||||
"""Part C contract ID — December."""
|
||||
|
||||
# ── Part C PBP IDs (ptc_pbp_id_01–12) ────────────────────
|
||||
ptc_pbp_id_01: str | None = None
|
||||
"""Part C plan benefit package ID — January
|
||||
(Coverage.extension[ptc_pbp_id_01] valueCoding)."""
|
||||
|
||||
ptc_pbp_id_02: str | None = None
|
||||
"""Part C PBP ID — February."""
|
||||
|
||||
ptc_pbp_id_03: str | None = None
|
||||
"""Part C PBP ID — March."""
|
||||
|
||||
ptc_pbp_id_04: str | None = None
|
||||
"""Part C PBP ID — April."""
|
||||
|
||||
ptc_pbp_id_05: str | None = None
|
||||
"""Part C PBP ID — May."""
|
||||
|
||||
ptc_pbp_id_06: str | None = None
|
||||
"""Part C PBP ID — June."""
|
||||
|
||||
ptc_pbp_id_07: str | None = None
|
||||
"""Part C PBP ID — July."""
|
||||
|
||||
ptc_pbp_id_08: str | None = None
|
||||
"""Part C PBP ID — August."""
|
||||
|
||||
ptc_pbp_id_09: str | None = None
|
||||
"""Part C PBP ID — September."""
|
||||
|
||||
ptc_pbp_id_10: str | None = None
|
||||
"""Part C PBP ID — October."""
|
||||
|
||||
ptc_pbp_id_11: str | None = None
|
||||
"""Part C PBP ID — November."""
|
||||
|
||||
ptc_pbp_id_12: str | None = None
|
||||
"""Part C PBP ID — December."""
|
||||
|
||||
# ── Part C plan type (ptc_plan_type_cd_01–12) ────────────
|
||||
ptc_plan_type_cd_01: str | None = None
|
||||
"""Part C plan type code — January
|
||||
(Coverage.extension[ptc_plan_type_cd_01] valueCoding)."""
|
||||
|
||||
ptc_plan_type_cd_02: str | None = None
|
||||
"""Part C plan type code — February."""
|
||||
|
||||
ptc_plan_type_cd_03: str | None = None
|
||||
"""Part C plan type code — March."""
|
||||
|
||||
ptc_plan_type_cd_04: str | None = None
|
||||
"""Part C plan type code — April."""
|
||||
|
||||
ptc_plan_type_cd_05: str | None = None
|
||||
"""Part C plan type code — May."""
|
||||
|
||||
ptc_plan_type_cd_06: str | None = None
|
||||
"""Part C plan type code — June."""
|
||||
|
||||
ptc_plan_type_cd_07: str | None = None
|
||||
"""Part C plan type code — July."""
|
||||
|
||||
ptc_plan_type_cd_08: str | None = None
|
||||
"""Part C plan type code — August."""
|
||||
|
||||
ptc_plan_type_cd_09: str | None = None
|
||||
"""Part C plan type code — September."""
|
||||
|
||||
ptc_plan_type_cd_10: str | None = None
|
||||
"""Part C plan type code — October."""
|
||||
|
||||
ptc_plan_type_cd_11: str | None = None
|
||||
"""Part C plan type code — November."""
|
||||
|
||||
ptc_plan_type_cd_12: str | None = None
|
||||
"""Part C plan type code — December."""
|
||||
|
||||
# ── Part D contract IDs (ptdcntrct01–12) ─────────────────
|
||||
ptdcntrct01: str | None = None
|
||||
"""Part D contract ID — January
|
||||
(Coverage.extension[ptdcntrct01] valueCoding)."""
|
||||
|
||||
ptdcntrct02: str | None = None
|
||||
"""Part D contract ID — February."""
|
||||
|
||||
ptdcntrct03: str | None = None
|
||||
"""Part D contract ID — March."""
|
||||
|
||||
ptdcntrct04: str | None = None
|
||||
"""Part D contract ID — April."""
|
||||
|
||||
ptdcntrct05: str | None = None
|
||||
"""Part D contract ID — May."""
|
||||
|
||||
ptdcntrct06: str | None = None
|
||||
"""Part D contract ID — June."""
|
||||
|
||||
ptdcntrct07: str | None = None
|
||||
"""Part D contract ID — July."""
|
||||
|
||||
ptdcntrct08: str | None = None
|
||||
"""Part D contract ID — August."""
|
||||
|
||||
ptdcntrct09: str | None = None
|
||||
"""Part D contract ID — September."""
|
||||
|
||||
ptdcntrct10: str | None = None
|
||||
"""Part D contract ID — October."""
|
||||
|
||||
ptdcntrct11: str | None = None
|
||||
"""Part D contract ID — November."""
|
||||
|
||||
ptdcntrct12: str | None = None
|
||||
"""Part D contract ID — December."""
|
||||
|
||||
# ── Part D PBP IDs (ptdpbpid01–12) ───────────────────────
|
||||
ptdpbpid01: str | None = None
|
||||
"""Part D plan benefit package ID — January
|
||||
(Coverage.extension[ptdpbpid01] valueCoding)."""
|
||||
|
||||
ptdpbpid02: str | None = None
|
||||
"""Part D PBP ID — February."""
|
||||
|
||||
ptdpbpid03: str | None = None
|
||||
"""Part D PBP ID — March."""
|
||||
|
||||
ptdpbpid04: str | None = None
|
||||
"""Part D PBP ID — April."""
|
||||
|
||||
ptdpbpid05: str | None = None
|
||||
"""Part D PBP ID — May."""
|
||||
|
||||
ptdpbpid06: str | None = None
|
||||
"""Part D PBP ID — June."""
|
||||
|
||||
ptdpbpid07: str | None = None
|
||||
"""Part D PBP ID — July."""
|
||||
|
||||
ptdpbpid08: str | None = None
|
||||
"""Part D PBP ID — August."""
|
||||
|
||||
ptdpbpid09: str | None = None
|
||||
"""Part D PBP ID — September."""
|
||||
|
||||
ptdpbpid10: str | None = None
|
||||
"""Part D PBP ID — October."""
|
||||
|
||||
ptdpbpid11: str | None = None
|
||||
"""Part D PBP ID — November."""
|
||||
|
||||
ptdpbpid12: str | None = None
|
||||
"""Part D PBP ID — December."""
|
||||
|
||||
# ── Part D segment IDs (sgmtid01–12) ─────────────────────
|
||||
sgmtid01: str | None = None
|
||||
"""Part D segment ID — January
|
||||
(Coverage.extension[sgmtid01] valueCoding)."""
|
||||
|
||||
sgmtid02: str | None = None
|
||||
"""Part D segment ID — February."""
|
||||
|
||||
sgmtid03: str | None = None
|
||||
"""Part D segment ID — March."""
|
||||
|
||||
sgmtid04: str | None = None
|
||||
"""Part D segment ID — April."""
|
||||
|
||||
sgmtid05: str | None = None
|
||||
"""Part D segment ID — May."""
|
||||
|
||||
sgmtid06: str | None = None
|
||||
"""Part D segment ID — June."""
|
||||
|
||||
sgmtid07: str | None = None
|
||||
"""Part D segment ID — July."""
|
||||
|
||||
sgmtid08: str | None = None
|
||||
"""Part D segment ID — August."""
|
||||
|
||||
sgmtid09: str | None = None
|
||||
"""Part D segment ID — September."""
|
||||
|
||||
sgmtid10: str | None = None
|
||||
"""Part D segment ID — October."""
|
||||
|
||||
sgmtid11: str | None = None
|
||||
"""Part D segment ID — November."""
|
||||
|
||||
sgmtid12: str | None = None
|
||||
"""Part D segment ID — December."""
|
||||
|
||||
# ── Medicare Advantage (ma_01–12, ext var '3-N') ─────────
|
||||
ma_01: str | None = None
|
||||
"""Medicare Advantage indicator — January
|
||||
(Coverage.extension[3-1] valueCoding)."""
|
||||
|
||||
ma_02: str | None = None
|
||||
"""Medicare Advantage indicator — February."""
|
||||
|
||||
ma_03: str | None = None
|
||||
"""Medicare Advantage indicator — March."""
|
||||
|
||||
ma_04: str | None = None
|
||||
"""Medicare Advantage indicator — April."""
|
||||
|
||||
ma_05: str | None = None
|
||||
"""Medicare Advantage indicator — May."""
|
||||
|
||||
ma_06: str | None = None
|
||||
"""Medicare Advantage indicator — June."""
|
||||
|
||||
ma_07: str | None = None
|
||||
"""Medicare Advantage indicator — July."""
|
||||
|
||||
ma_08: str | None = None
|
||||
"""Medicare Advantage indicator — August."""
|
||||
|
||||
ma_09: str | None = None
|
||||
"""Medicare Advantage indicator — September."""
|
||||
|
||||
ma_10: str | None = None
|
||||
"""Medicare Advantage indicator — October."""
|
||||
|
||||
ma_11: str | None = None
|
||||
"""Medicare Advantage indicator — November."""
|
||||
|
||||
ma_12: str | None = None
|
||||
"""Medicare Advantage indicator — December."""
|
||||
573
src/bcda/table/eob.py
Normal file
573
src/bcda/table/eob.py
Normal file
@@ -0,0 +1,573 @@
|
||||
"""FHIR R4 ExplanationOfBenefit resource — adjudicated claims.
|
||||
|
||||
Flattened from the BCDA v2 ExplanationOfBenefit ndjson export.
|
||||
Covers Part A (institutional), Part B (professional/DME), and
|
||||
Part D (pharmacy) claims in a single resource type.
|
||||
|
||||
The FHIR EOB is hierarchical: header-level fields (billablePeriod,
|
||||
diagnosis, procedure, careTeam, payment) plus repeating item-level
|
||||
fields (line items with revenue codes, HCPCS, adjudication amounts).
|
||||
This model represents the header-level flattened fields; item-level
|
||||
arrays are modeled separately in ``EobItem``.
|
||||
|
||||
Source: ``/api/v2/ExplanationOfBenefit/$export`` bulk FHIR endpoint.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import date
|
||||
|
||||
from aco.table.base import SQLTable
|
||||
|
||||
|
||||
class ExplanationOfBenefit(SQLTable):
|
||||
"""FHIR R4 ExplanationOfBenefit — header-level claim fields."""
|
||||
|
||||
__schema__ = "bcda"
|
||||
__tablename__ = "explanation_of_benefit"
|
||||
|
||||
# ── Resource metadata ────────────────────────────────────
|
||||
id: str | None = None
|
||||
"""FHIR resource ID (Eob.id)."""
|
||||
|
||||
last_updated: str | None = None
|
||||
"""Resource last-updated timestamp (Eob.meta.lastUpdated)."""
|
||||
|
||||
# ── Identifiers (BCDA-only) ──────────────────────────────
|
||||
bene_id: str | None = None
|
||||
"""CCW beneficiary identifier (Eob.patient reference)."""
|
||||
|
||||
clm_id: str | None = None
|
||||
"""Unique claim identifier (Eob.identifier).
|
||||
Parts A/B claims."""
|
||||
|
||||
pde_id: str | None = None
|
||||
"""Part D event identifier (Eob.identifier).
|
||||
Part D claims only."""
|
||||
|
||||
clm_grp_id: float | None = None
|
||||
"""Claim group identifier (Eob.identifier)."""
|
||||
|
||||
clm_sub_type: str | None = None
|
||||
"""Claim sub type (Eob.subType.coding.code)."""
|
||||
|
||||
# ── Claim type and dates ─────────────────────────────────
|
||||
clm_type_cd: str | None = None
|
||||
"""Claim type code (Eob.type.coding.code)."""
|
||||
|
||||
nch_near_line_rec_ident_cd: str | None = None
|
||||
"""NCH near-line record identification code — claim category
|
||||
(Eob.extension[nch_near_line_rec_ident_cd] valueCoding).
|
||||
Values: V=Part A, O=Part B carrier, M=Part B DME, P=Part D."""
|
||||
|
||||
clm_from_dt: date | None = None
|
||||
"""Billing period start (Eob.billablePeriod.start)."""
|
||||
|
||||
clm_thru_dt: date | None = None
|
||||
"""Billing period end (Eob.billablePeriod.end)."""
|
||||
|
||||
clm_efctv_dt: date | None = None
|
||||
"""NCH weekly processing date (Eob.supportingInfo timingDate)."""
|
||||
|
||||
clm_query_cd: str | None = None
|
||||
"""Claim query code — debit/credit indicator
|
||||
(Eob.billablePeriod.extension valueCoding)."""
|
||||
|
||||
clm_disp_cd: str | None = None
|
||||
"""Claim disposition code (Eob.disposition)."""
|
||||
|
||||
# ── Facility and provider ────────────────────────────────
|
||||
prvdr_oscar_num: str | None = None
|
||||
"""Provider OSCAR/CCN number (Eob.contained identifier)."""
|
||||
|
||||
fac_prvdr_npi_num: str | None = None
|
||||
"""Facility NPI (Eob.contained identifier)."""
|
||||
|
||||
clm_bill_fac_type_cd: str | None = None
|
||||
"""Type of bill — facility type, TOB1
|
||||
(Eob.facility.extension valueCoding)."""
|
||||
|
||||
clm_bill_clsfctn_cd: str | None = None
|
||||
"""Type of bill — classification, TOB2
|
||||
(Eob.extension valueCoding)."""
|
||||
|
||||
clm_bill_freq_cd: str | None = None
|
||||
"""Type of bill — frequency, TOB3
|
||||
(Eob.supportingInfo.code.coding)."""
|
||||
|
||||
clm_srvc_clsfctn_type_cd: str | None = None
|
||||
"""Service classification type code
|
||||
(Eob.extension[clm_srvc_clsfctn_type_cd] valueCoding)."""
|
||||
|
||||
clm_op_srvc_type_cd: str | None = None
|
||||
"""Outpatient service type code (Eob.type.coding)."""
|
||||
|
||||
prvdr_fac_fips_st_cd: str | None = None
|
||||
"""Facility FIPS state code (Eob.item.locationAddress.state)."""
|
||||
|
||||
carr_clm_blg_npi_num: str | None = None
|
||||
"""Carrier claim billing NPI (Eob.provider.identifier).
|
||||
BCDA-only — Part B carrier claims."""
|
||||
|
||||
fi_num: str | None = None
|
||||
"""Fiscal intermediary number
|
||||
(Eob.extension[fi_num] valueCoding).
|
||||
Part A claims."""
|
||||
|
||||
carr_num: str | None = None
|
||||
"""Carrier number
|
||||
(Eob.extension[carr_num] valueCoding).
|
||||
Part B carrier claims."""
|
||||
|
||||
# ── Care team ────────────────────────────────────────────
|
||||
oprtg_prvdr_npi_num: str | None = None
|
||||
"""Operating provider NPI (Eob.careTeam provider identifier)."""
|
||||
|
||||
atndg_prvdr_npi_num: str | None = None
|
||||
"""Attending provider NPI (Eob.careTeam provider identifier)."""
|
||||
|
||||
othr_prvdr_npi_num: str | None = None
|
||||
"""Other provider NPI (Eob.careTeam provider identifier)."""
|
||||
|
||||
rndrg_prvdr_npi_num: str | None = None
|
||||
"""Rendering provider NPI (Eob.careTeam provider identifier).
|
||||
Part B claims."""
|
||||
|
||||
clm_prsbng_prvdr_gnrc_id_num: str | None = None
|
||||
"""Prescribing provider identifier (Eob.careTeam provider).
|
||||
Part D claims."""
|
||||
|
||||
rndrg_prvdr_type_cd: str | None = None
|
||||
"""Rendering provider type code
|
||||
(Eob.careTeam extension valueCoding)."""
|
||||
|
||||
clm_prvdr_spclty_cd: str | None = None
|
||||
"""Provider specialty code (Eob.careTeam qualification coding)."""
|
||||
|
||||
clm_rndrg_prvdr_tax_num: str | None = None
|
||||
"""Rendering provider tax number
|
||||
(Eob.item extension valueCoding)."""
|
||||
|
||||
rndrg_prvdr_fips_st_cd: str | None = None
|
||||
"""Rendering provider FIPS state code
|
||||
(Eob.item locationCodeableConcept extension)."""
|
||||
|
||||
payto_prvdr_npi_num: str | None = None
|
||||
"""Pay-to provider NPI (Eob.item extension/careTeam).
|
||||
Part B DME claims."""
|
||||
|
||||
ordrg_prvdr_npi_num: str | None = None
|
||||
"""Ordering provider NPI (Eob.referral.identifier).
|
||||
Part B DME claims."""
|
||||
|
||||
carr_line_prvdr_type_cd: str | None = None
|
||||
"""Carrier line provider type code
|
||||
(Eob.careTeam.extension[carr_line_prvdr_type_cd] valueCoding).
|
||||
Part B carrier claims."""
|
||||
|
||||
prtcptng_ind_cd: str | None = None
|
||||
"""Participating provider indicator code
|
||||
(Eob.careTeam.extension[prtcptng_ind_cd] valueCoding).
|
||||
Part B carrier claims."""
|
||||
|
||||
# ── Diagnosis ────────────────────────────────────────────
|
||||
prncpl_dgns_cd: str | None = None
|
||||
"""Principal diagnosis code (Eob.diagnosis type='principal')."""
|
||||
|
||||
admtg_dgns_cd: str | None = None
|
||||
"""Admitting diagnosis code (Eob.diagnosis type='admitting')."""
|
||||
|
||||
clm_dgns_cd: str | None = None
|
||||
"""Diagnosis code — Part A diagnosis file
|
||||
(Eob.diagnosis diagnosisCodeableConcept)."""
|
||||
|
||||
clm_dgns_1_cd: str | None = None
|
||||
"""Diagnosis code 1 (Eob.diagnosis[0])."""
|
||||
|
||||
clm_dgns_2_cd: str | None = None
|
||||
"""Diagnosis code 2 (Eob.diagnosis[1])."""
|
||||
|
||||
clm_dgns_3_cd: str | None = None
|
||||
"""Diagnosis code 3 (Eob.diagnosis[2])."""
|
||||
|
||||
clm_dgns_4_cd: str | None = None
|
||||
"""Diagnosis code 4 (Eob.diagnosis[3])."""
|
||||
|
||||
clm_dgns_5_cd: str | None = None
|
||||
"""Diagnosis code 5 (Eob.diagnosis[4])."""
|
||||
|
||||
clm_dgns_6_cd: str | None = None
|
||||
"""Diagnosis code 6 (Eob.diagnosis[5])."""
|
||||
|
||||
clm_dgns_7_cd: str | None = None
|
||||
"""Diagnosis code 7 (Eob.diagnosis[6])."""
|
||||
|
||||
clm_dgns_8_cd: str | None = None
|
||||
"""Diagnosis code 8 (Eob.diagnosis[7])."""
|
||||
|
||||
clm_dgns_9_cd: str | None = None
|
||||
"""Diagnosis code 9 (Eob.diagnosis[8])."""
|
||||
|
||||
clm_dgns_10_cd: str | None = None
|
||||
"""Diagnosis code 10 (Eob.diagnosis[9])."""
|
||||
|
||||
clm_dgns_11_cd: str | None = None
|
||||
"""Diagnosis code 11 (Eob.diagnosis[10])."""
|
||||
|
||||
clm_dgns_12_cd: str | None = None
|
||||
"""Diagnosis code 12 (Eob.diagnosis[11])."""
|
||||
|
||||
dgns_prcdr_icd_ind: str | None = None
|
||||
"""ICD version indicator — '9' ICD-9, '0' ICD-10
|
||||
(Eob.diagnosis coding.system)."""
|
||||
|
||||
clm_prod_type_cd: str | None = None
|
||||
"""Diagnosis product type code (Eob.diagnosis type coding)."""
|
||||
|
||||
clm_poa_ind: str | None = None
|
||||
"""Present on admission indicator (Eob.diagnosis extension)."""
|
||||
|
||||
clm_line_dgns_cd: str | None = None
|
||||
"""Line-item diagnosis code — Part B
|
||||
(Eob.diagnosis diagnosisCodeableConcept)."""
|
||||
|
||||
# ── Procedure ────────────────────────────────────────────
|
||||
clm_val_sqnc_num: str | None = None
|
||||
"""Procedure sequence number (Eob.procedure.sequence)."""
|
||||
|
||||
clm_prcdr_cd: str | None = None
|
||||
"""Procedure code (Eob.procedure procedureCodeableConcept)."""
|
||||
|
||||
clm_prcdr_prfrm_dt: date | None = None
|
||||
"""Procedure performed date (Eob.procedure.date)."""
|
||||
|
||||
# ── Payment and amounts ──────────────────────────────────
|
||||
clm_pmt_amt: float | None = None
|
||||
"""Medicare payment amount (Eob.payment.amount.value)."""
|
||||
|
||||
clm_mdcr_instnl_tot_chrg_amt: float | None = None
|
||||
"""Institutional total charge (Eob.total amount)."""
|
||||
|
||||
clm_mdcr_ip_pps_cptl_ime_amt: float | None = None
|
||||
"""Capital IME amount (Eob.benefitBalance financial)."""
|
||||
|
||||
clm_oprtnl_ime_amt: float | None = None
|
||||
"""Operational IME amount (Eob.extension valueMoney)."""
|
||||
|
||||
ime_op_clm_val_amt: float | None = None
|
||||
"""Operational IME amount — alternate ext key
|
||||
(Eob.extension[ime_op_clm_val_amt] valueMoney)."""
|
||||
|
||||
clm_mdcr_ip_pps_dsprprtnt_amt: float | None = None
|
||||
"""Capital DSH amount (Eob.benefitBalance financial)."""
|
||||
|
||||
clm_hipps_uncompd_care_amt: float | None = None
|
||||
"""Uncompensated care amount (Eob.extension valueMoney)."""
|
||||
|
||||
clm_uncompd_care_pmt_amt: float | None = None
|
||||
"""Uncompensated care payment amount — alternate ext key
|
||||
(Eob.extension[clm_uncompd_care_pmt_amt] valueMoney)."""
|
||||
|
||||
clm_oprtnl_dsprtnt_amt: float | None = None
|
||||
"""Operational DSH amount (Eob.extension valueMoney)."""
|
||||
|
||||
dsh_op_clm_val_amt: float | None = None
|
||||
"""Operational DSH amount — alternate ext key
|
||||
(Eob.extension[dsh_op_clm_val_amt] valueMoney)."""
|
||||
|
||||
# ── Supporting info ──────────────────────────────────────
|
||||
clm_nch_prmry_pyr_cd: str | None = None
|
||||
"""Primary payer code (Eob.supportingInfo code coding)."""
|
||||
|
||||
bene_ptnt_stus_cd: str | None = None
|
||||
"""Patient status code (Eob.supportingInfo code coding)."""
|
||||
|
||||
dgns_drg_cd: str | None = None
|
||||
"""DRG code (Eob.supportingInfo code coding)."""
|
||||
|
||||
clm_admsn_type_cd: str | None = None
|
||||
"""Admission type code (Eob.supportingInfo code coding)."""
|
||||
|
||||
clm_admsn_src_cd: str | None = None
|
||||
"""Admission source code (Eob.supportingInfo code coding)."""
|
||||
|
||||
clm_mco_pd_sw: str | None = None
|
||||
"""MCO paid switch — managed care organization paid flag
|
||||
(Eob.supportingInfo[clm_mco_pd_sw] code coding)."""
|
||||
|
||||
nch_blood_pnts_frnshd_qty: float | None = None
|
||||
"""Blood pints furnished quantity
|
||||
(Eob.supportingInfo[nch_blood_pnts_frnshd_qty] valueQuantity)."""
|
||||
|
||||
clm_mdcr_npmt_rsn_cd: str | None = None
|
||||
"""Medicare non-payment reason code (Eob.extension valueCoding)."""
|
||||
|
||||
clm_carr_pmt_dnl_cd: str | None = None
|
||||
"""Carrier payment denial code (Eob.extension valueCoding).
|
||||
Part B claims."""
|
||||
|
||||
clm_cntl_num: str | None = None
|
||||
"""Claim control number (Eob.extension valueIdentifier)."""
|
||||
|
||||
fi_doc_clm_cntl_num: str | None = None
|
||||
"""FI document claim control number
|
||||
(Eob.extension[fi_doc_clm_cntl_num] valueIdentifier)."""
|
||||
|
||||
fi_clm_actn_cd: str | None = None
|
||||
"""FI claim action code
|
||||
(Eob.extension[fi_clm_actn_cd] valueCoding)."""
|
||||
|
||||
carr_clm_cntl_num: str | None = None
|
||||
"""Carrier claim control number
|
||||
(Eob.extension[carr_clm_cntl_num] valueIdentifier)."""
|
||||
|
||||
carr_clm_entry_cd: str | None = None
|
||||
"""Carrier claim entry code
|
||||
(Eob.extension[carr_clm_entry_cd] valueCoding)."""
|
||||
|
||||
asgmntcd: str | None = None
|
||||
"""Assignment code — provider accepts assignment
|
||||
(Eob.extension[asgmntcd] valueCoding).
|
||||
Part B carrier claims."""
|
||||
|
||||
clm_actv_care_from_dt: date | None = None
|
||||
"""Active care from date (Eob.supportingInfo timingPeriod)."""
|
||||
|
||||
bene_rng_bgn_dt: date | None = None
|
||||
"""Hospice range begin date (Eob.supportingInfo timingPeriod)."""
|
||||
|
||||
bene_rng_end_dt: date | None = None
|
||||
"""Hospice range end date (Eob.supportingInfo timingPeriod)."""
|
||||
|
||||
# ── Part D specific ──────────────────────────────────────
|
||||
clm_srvc_prvdr_gnrc_id_num: str | None = None
|
||||
"""Service provider identifier (Eob.facility identifier).
|
||||
Part D pharmacy."""
|
||||
|
||||
clm_daw_prod_slctn_cd: str | None = None
|
||||
"""Dispense as written code (Eob.supportingInfo code coding)."""
|
||||
|
||||
clm_line_days_suply_qty: float | None = None
|
||||
"""Days supply quantity (Eob.supportingInfo valueQuantity)."""
|
||||
|
||||
clm_line_rx_srvc_rfrnc_num: str | None = None
|
||||
"""Rx service reference number (Eob.identifier)."""
|
||||
|
||||
clm_line_rx_fill_num: float | None = None
|
||||
"""Rx fill number (Eob.supportingInfo valueQuantity)."""
|
||||
|
||||
clm_phrmcy_srvc_type_cd: str | None = None
|
||||
"""Pharmacy service type code
|
||||
(Eob.facility extension valueCoding)."""
|
||||
|
||||
|
||||
class EobItem(SQLTable):
|
||||
"""FHIR R4 ExplanationOfBenefit.item — claim line items.
|
||||
|
||||
One row per line item within a claim. Covers revenue center
|
||||
lines (Part A), carrier/DME lines (Part B), and Part D lines.
|
||||
"""
|
||||
|
||||
__schema__ = "bcda"
|
||||
__tablename__ = "eob_item"
|
||||
|
||||
# ── Parent claim reference ───────────────────────────────
|
||||
clm_id: str | None = None
|
||||
"""Parent claim identifier."""
|
||||
|
||||
clm_line_num: float | None = None
|
||||
"""Line item sequence number (Eob.item.sequence)."""
|
||||
|
||||
# ── Service dates ────────────────────────────────────────
|
||||
clm_line_from_dt: date | None = None
|
||||
"""Line service start date (Eob.item.servicedPeriod.start)."""
|
||||
|
||||
clm_line_thru_dt: date | None = None
|
||||
"""Line service end date (Eob.item.servicedPeriod.end)."""
|
||||
|
||||
clm_line_instnl_rev_ctr_dt: date | None = None
|
||||
"""Revenue center date (Eob.item.servicedPeriod.start).
|
||||
Part A institutional claims."""
|
||||
|
||||
# ── Codes ────────────────────────────────────────────────
|
||||
clm_line_prod_rev_ctr_cd: str | None = None
|
||||
"""Revenue center code (Eob.item.revenue.coding.code).
|
||||
Part A institutional claims."""
|
||||
|
||||
clm_rev_apc_hipps_cd: str | None = None
|
||||
"""APC/HIPPS code (Eob.item.revenue coding)."""
|
||||
|
||||
clm_line_hcpcs_cd: str | None = None
|
||||
"""HCPCS procedure code (Eob.item.productOrService coding)."""
|
||||
|
||||
clm_line_ndc_cd: str | None = None
|
||||
"""National Drug Code (Eob.item.productOrService coding).
|
||||
Part D claims."""
|
||||
|
||||
hcpcs_1_mdfr_cd: str | None = None
|
||||
"""HCPCS modifier 1 (Eob.item.modifier[0])."""
|
||||
|
||||
hcpcs_2_mdfr_cd: str | None = None
|
||||
"""HCPCS modifier 2 (Eob.item.modifier[1])."""
|
||||
|
||||
hcpcs_3_mdfr_cd: str | None = None
|
||||
"""HCPCS modifier 3 (Eob.item.modifier[2])."""
|
||||
|
||||
hcpcs_4_mdfr_cd: str | None = None
|
||||
"""HCPCS modifier 4 (Eob.item.modifier[3])."""
|
||||
|
||||
hcpcs_5_mdfr_cd: str | None = None
|
||||
"""HCPCS modifier 5 (Eob.item.modifier[4])."""
|
||||
|
||||
hcpcs_betos_cd: str | None = None
|
||||
"""BETOS code (Eob.item.extension[betos_cd] valueCoding)."""
|
||||
|
||||
rev_cntr_stus_ind_cd: str | None = None
|
||||
"""Revenue center status indicator code
|
||||
(Eob.item.revenue.extension[rev_cntr_stus_ind_cd] valueCoding).
|
||||
Part A institutional claims."""
|
||||
|
||||
# ── Service classification ───────────────────────────────
|
||||
clm_fed_type_srvc_cd: str | None = None
|
||||
"""Type of service code (Eob.item.category coding)."""
|
||||
|
||||
clm_pos_cd: str | None = None
|
||||
"""Place of service code
|
||||
(Eob.item.locationCodeableConcept coding)."""
|
||||
|
||||
carr_line_prcng_lclty_cd: str | None = None
|
||||
"""Carrier line pricing locality code
|
||||
(Eob.item.locationCodeableConcept.extension valueCoding).
|
||||
Part B carrier claims."""
|
||||
|
||||
prvdr_state_cd: str | None = None
|
||||
"""Provider state code
|
||||
(Eob.item.locationCodeableConcept.extension valueCoding)."""
|
||||
|
||||
prvdr_zip: str | None = None
|
||||
"""Provider ZIP code
|
||||
(Eob.item.locationCodeableConcept.extension valueCoding)."""
|
||||
|
||||
# ── Quantities ───────────────────────────────────────────
|
||||
clm_line_srvc_unit_qty: float | None = None
|
||||
"""Service unit quantity (Eob.item.quantity.value)."""
|
||||
|
||||
rev_cntr_unit_cnt: float | None = None
|
||||
"""Revenue center unit count
|
||||
(Eob.item.extension[rev_cntr_unit_cnt] valueQuantity)."""
|
||||
|
||||
carr_line_mtus_cnt: float | None = None
|
||||
"""Carrier line MTUS count
|
||||
(Eob.item.extension[carr_line_mtus_cnt] valueQuantity)."""
|
||||
|
||||
carr_line_mtus_cd: str | None = None
|
||||
"""Carrier line MTUS code
|
||||
(Eob.item.extension[carr_line_mtus_cd] valueCoding)."""
|
||||
|
||||
# ── Adjudication amounts (standard FHIR) ─────────────────
|
||||
clm_line_cvrd_pd_amt: float | None = None
|
||||
"""Covered paid amount (Eob.item.adjudication[benefit])."""
|
||||
|
||||
clm_line_alowd_chrg_amt: float | None = None
|
||||
"""Allowed charge amount (Eob.item.adjudication[eligible])."""
|
||||
|
||||
clm_line_sbmtd_chrg_amt: float | None = None
|
||||
"""Submitted charge amount (Eob.item.adjudication[submitted])."""
|
||||
|
||||
clm_line_bene_pmt_amt: float | None = None
|
||||
"""Beneficiary payment amount (Eob.item.adjudication[paidtopatient])."""
|
||||
|
||||
clm_line_prvdr_pmt_amt: float | None = None
|
||||
"""Provider payment amount (Eob.item.adjudication[paidtoprovider])."""
|
||||
|
||||
clm_line_bene_prmry_pyr_pd_amt: float | None = None
|
||||
"""Beneficiary primary payer paid amount
|
||||
(Eob.item.adjudication[priorpayerpaid])."""
|
||||
|
||||
clm_line_coinsrnc_amt: float | None = None
|
||||
"""Coinsurance amount (Eob.item.adjudication[coinsurance])."""
|
||||
|
||||
clm_line_bene_ptb_ddctbl_amt: float | None = None
|
||||
"""Beneficiary Part B deductible amount
|
||||
(Eob.item.adjudication[deductible])."""
|
||||
|
||||
clm_line_ncvrd_chrg_amt: float | None = None
|
||||
"""Non-covered charge amount (Eob.item.adjudication[noncovered])."""
|
||||
|
||||
# ── Adjudication amounts (BB revenue center) ─────────────
|
||||
rev_cntr_pmt_amt: float | None = None
|
||||
"""Revenue center payment amount
|
||||
(Eob.item.adjudication[rev_cntr_pmt_amt_amt])."""
|
||||
|
||||
rev_cntr_tot_chrg_amt: float | None = None
|
||||
"""Revenue center total charge amount
|
||||
(Eob.item.adjudication[rev_cntr_tot_chrg_amt])."""
|
||||
|
||||
rev_cntr_rate_amt: float | None = None
|
||||
"""Revenue center rate amount
|
||||
(Eob.item.adjudication[rev_cntr_rate_amt])."""
|
||||
|
||||
rev_cntr_bene_pmt_amt: float | None = None
|
||||
"""Revenue center beneficiary payment amount
|
||||
(Eob.item.adjudication[rev_cntr_bene_pmt_amt])."""
|
||||
|
||||
rev_cntr_prvdr_pmt_amt: float | None = None
|
||||
"""Revenue center provider payment amount
|
||||
(Eob.item.adjudication[rev_cntr_prvdr_pmt_amt])."""
|
||||
|
||||
rev_cntr_ptnt_rspnsblty_pmt: float | None = None
|
||||
"""Revenue center patient responsibility payment
|
||||
(Eob.item.adjudication[rev_cntr_ptnt_rspnsblty_pmt])."""
|
||||
|
||||
rev_cntr_ncvrd_chrg_amt: float | None = None
|
||||
"""Revenue center non-covered charge amount
|
||||
(Eob.item.adjudication[rev_cntr_ncvrd_chrg_amt])."""
|
||||
|
||||
rev_cntr_cash_ddctbl_amt: float | None = None
|
||||
"""Revenue center cash deductible amount
|
||||
(Eob.item.adjudication[rev_cntr_cash_ddctbl_amt])."""
|
||||
|
||||
rev_cntr_blood_ddctbl_amt: float | None = None
|
||||
"""Revenue center blood deductible amount
|
||||
(Eob.item.adjudication[rev_cntr_blood_ddctbl_amt])."""
|
||||
|
||||
rev_cntr_coinsrnc_wge_adjstd_c: float | None = None
|
||||
"""Revenue center coinsurance/wage adjusted amount
|
||||
(Eob.item.adjudication[rev_cntr_coinsrnc_wge_adjstd_c])."""
|
||||
|
||||
rev_cntr_rdcd_coinsrnc_amt: float | None = None
|
||||
"""Revenue center reduced coinsurance amount
|
||||
(Eob.item.adjudication[rev_cntr_rdcd_coinsrnc_amt])."""
|
||||
|
||||
rev_cntr_1st_msp_pd_amt: float | None = None
|
||||
"""Revenue center 1st MSP paid amount
|
||||
(Eob.item.adjudication[rev_cntr_1st_msp_pd_amt])."""
|
||||
|
||||
rev_cntr_2nd_msp_pd_amt: float | None = None
|
||||
"""Revenue center 2nd MSP paid amount
|
||||
(Eob.item.adjudication[rev_cntr_2nd_msp_pd_amt])."""
|
||||
|
||||
line_pmt_80_100_cd: str | None = None
|
||||
"""Line payment 80%/100% code — indicates whether 80% or 100%
|
||||
payment was applied to the line
|
||||
(Eob.item.adjudication.extension[line_pmt_80_100_cd] valueCoding).
|
||||
Part B carrier claims."""
|
||||
|
||||
# ── Line-level extensions ────────────────────────────────
|
||||
clm_line_prmry_pyr_cd: str | None = None
|
||||
"""Line primary payer code (Eob.item extension valueCoding)."""
|
||||
|
||||
clm_prmry_pyr_cd: str | None = None
|
||||
"""Primary payer code — DME (Eob.item extension valueCoding)."""
|
||||
|
||||
clm_prcsg_ind_cd: str | None = None
|
||||
"""Processing indicator code
|
||||
(Eob.item.extension[line_prcsg_ind_cd] valueCoding)."""
|
||||
|
||||
line_service_deductible: str | None = None
|
||||
"""Line-level service deductible indicator
|
||||
(Eob.item.extension[line_service_deductible] valueCoding)."""
|
||||
|
||||
tax_num: str | None = None
|
||||
"""Line-level provider tax number
|
||||
(Eob.item.extension[tax_num] valueCoding)."""
|
||||
192
src/bcda/table/fiss.py
Normal file
192
src/bcda/table/fiss.py
Normal file
@@ -0,0 +1,192 @@
|
||||
"""Institutional partially adjudicated claims (FISS).
|
||||
|
||||
Partially adjudicated claims sourced from institutional claim
|
||||
submissions processed by the Fiscal Intermediary Standard System
|
||||
(FISS). Available via BCDA v2 FHIR R4 Claim and ClaimResponse
|
||||
resources, updated daily (2-4 day lag vs 14+ for adjudicated).
|
||||
|
||||
47 fields derived from the BCDA Partially Adjudicated Claims
|
||||
Data Dictionary v1.1.0.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import date
|
||||
|
||||
from aco.table.base import SQLTable
|
||||
|
||||
|
||||
class FissClaim(SQLTable):
|
||||
"""Institutional partially adjudicated claim (FISS Claim resource)."""
|
||||
|
||||
__schema__ = "bcda"
|
||||
__tablename__ = "fiss_claim"
|
||||
|
||||
dcn: str | None = None
|
||||
"""Document Control Number — unique FISS identifier for the claim."""
|
||||
|
||||
lob_cd: str | None = None
|
||||
"""Location of Bill Code — the type of facility (TOB1)."""
|
||||
|
||||
serv_typ_cd: str | None = None
|
||||
"""Service Type Code — the type of service provided (TOB2)."""
|
||||
|
||||
freq_cd: str | None = None
|
||||
"""Bill Frequency — third digit of type of bill (TOB3)."""
|
||||
|
||||
stmt_cov_from_dt: date | None = None
|
||||
"""Statement Covered From Date — first day on the billing statement."""
|
||||
|
||||
stmt_cov_to_dt: date | None = None
|
||||
"""Statement Covered To Date — last day on the billing statement."""
|
||||
|
||||
total_charge_amt: float | None = None
|
||||
"""Total charges for all services on the institutional claim."""
|
||||
|
||||
mbi: str | None = None
|
||||
"""Medicare Beneficiary Identifier."""
|
||||
|
||||
bene_first_name: str | None = None
|
||||
"""Beneficiary first name (first 10 characters)."""
|
||||
|
||||
bene_mid_init: str | None = None
|
||||
"""Beneficiary middle initial."""
|
||||
|
||||
bene_last_name: str | None = None
|
||||
"""Beneficiary last name (first 15 characters)."""
|
||||
|
||||
bene_dob: date | None = None
|
||||
"""Beneficiary date of birth."""
|
||||
|
||||
bene_sex: str | None = None
|
||||
"""Beneficiary sex."""
|
||||
|
||||
npi_number: str | None = None
|
||||
"""National Provider Identifier of the organization or group practice."""
|
||||
|
||||
meda_prov_6: str | None = None
|
||||
"""Medicare Provider Number (first 6 digits — state + provider type)."""
|
||||
|
||||
fed_tax_nb: str | None = None
|
||||
"""Federal Tax Number (TIN/EIN) of the provider."""
|
||||
|
||||
adm_diag_cd: str | None = None
|
||||
"""Admitting Diagnosis Code (ICD-9/10)."""
|
||||
|
||||
diag_cd_2: str | None = None
|
||||
"""Diagnosis Code — beneficiary diagnosis or external cause of injury."""
|
||||
|
||||
diag_poa_ind: str | None = None
|
||||
"""Diagnosis Present On Admission (POA) indicator."""
|
||||
|
||||
proc_cd: str | None = None
|
||||
"""Procedure Code (ICD) performed during the covered period."""
|
||||
|
||||
proc_dt: date | None = None
|
||||
"""Procedure date."""
|
||||
|
||||
payers_name: str | None = None
|
||||
"""Primary insurer payer name associated with the claim."""
|
||||
|
||||
drg_cd: str | None = None
|
||||
"""Diagnosis Related Group code."""
|
||||
|
||||
non_bill_rev_code: str | None = None
|
||||
"""Non Billable Code — whether revenue/HCPCS codes are valid."""
|
||||
|
||||
rev_cd: str | None = None
|
||||
"""Revenue Center Code — provider-assigned cost center code."""
|
||||
|
||||
rev_units_billed: float | None = None
|
||||
"""Total units/number of services billed per revenue code."""
|
||||
|
||||
rev_serv_unit_cnt: float | None = None
|
||||
"""Service unit count per HCPCS/revenue code."""
|
||||
|
||||
serv_dt: date | None = None
|
||||
"""Service date for the line item."""
|
||||
|
||||
hcpc_cd: str | None = None
|
||||
"""HCPCS code for the procedure, supply, or service."""
|
||||
|
||||
hcpc_ind: str | None = None
|
||||
"""HCPC Indicator."""
|
||||
|
||||
hcpc_modifier: str | None = None
|
||||
"""HCPCS modifier — first occurrence."""
|
||||
|
||||
hcpc_modifier2: str | None = None
|
||||
"""HCPCS modifier — second occurrence."""
|
||||
|
||||
hcpc_modifier3: str | None = None
|
||||
"""HCPCS modifier — third occurrence."""
|
||||
|
||||
hcpc_modifier4: str | None = None
|
||||
"""HCPCS modifier — fourth occurrence."""
|
||||
|
||||
hcpc_modifier5: str | None = None
|
||||
"""HCPCS modifier — fifth occurrence."""
|
||||
|
||||
apc_hcpcs_apc: str | None = None
|
||||
"""Ambulatory Payment Classification HCPCS APC group code."""
|
||||
|
||||
ndc: str | None = None
|
||||
"""National Drug Code."""
|
||||
|
||||
ndc_qty: float | None = None
|
||||
"""NDC medication quantity administered."""
|
||||
|
||||
ndc_qty_qual: str | None = None
|
||||
"""NDC quantity qualifier (unit of measure)."""
|
||||
|
||||
adm_typ_cd: str | None = None
|
||||
"""Admission Type Code — type and priority of inpatient services."""
|
||||
|
||||
|
||||
class FissClaimResponse(SQLTable):
|
||||
"""Institutional partially adjudicated claim response (FISS)."""
|
||||
|
||||
__schema__ = "bcda"
|
||||
__tablename__ = "fiss_claim_response"
|
||||
|
||||
dcn: str | None = None
|
||||
"""Document Control Number — unique FISS identifier for the claim."""
|
||||
|
||||
curr_status: str | None = None
|
||||
"""Current claim status (paid, reject, deny, etc.)."""
|
||||
|
||||
recd_dt: date | None = None
|
||||
"""Date the claim was received by the intermediary."""
|
||||
|
||||
curr_tran_dt: date | None = None
|
||||
"""Current transaction date — last date the status changed."""
|
||||
|
||||
mbi: str | None = None
|
||||
"""Medicare Beneficiary Identifier."""
|
||||
|
||||
bene_first_name: str | None = None
|
||||
"""Beneficiary first name (first 10 characters)."""
|
||||
|
||||
bene_mid_init: str | None = None
|
||||
"""Beneficiary middle initial."""
|
||||
|
||||
bene_last_name: str | None = None
|
||||
"""Beneficiary last name (first 15 characters)."""
|
||||
|
||||
bene_dob: date | None = None
|
||||
"""Beneficiary date of birth."""
|
||||
|
||||
bene_sex: str | None = None
|
||||
"""Beneficiary sex."""
|
||||
|
||||
group_code: str | None = None
|
||||
"""ANSI group code at the claim level."""
|
||||
|
||||
aco_red_rarc: str | None = None
|
||||
"""ACO Reduction Remittance Advice Remark Code."""
|
||||
|
||||
aco_red_carc: str | None = None
|
||||
"""Pioneer ACO Reduction Claim Adjustment Reason Code."""
|
||||
|
||||
aco_red_cagc: str | None = None
|
||||
"""Pioneer ACO Reduction Group Code."""
|
||||
141
src/bcda/table/mcs.py
Normal file
141
src/bcda/table/mcs.py
Normal file
@@ -0,0 +1,141 @@
|
||||
"""Professional partially adjudicated claims (MCS).
|
||||
|
||||
Partially adjudicated claims sourced from professional claim
|
||||
submissions processed by the Multi-Carrier System (MCS).
|
||||
Available via BCDA v2 FHIR R4 Claim and ClaimResponse resources,
|
||||
updated daily (2-4 day lag vs 14+ for adjudicated).
|
||||
|
||||
31 fields derived from the BCDA Partially Adjudicated Claims
|
||||
Data Dictionary v1.1.0.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import date
|
||||
|
||||
from aco.table.base import SQLTable
|
||||
|
||||
|
||||
class McsClaim(SQLTable):
|
||||
"""Professional partially adjudicated claim (MCS Claim resource)."""
|
||||
|
||||
__schema__ = "bcda"
|
||||
__tablename__ = "mcs_claim"
|
||||
|
||||
icn: str | None = None
|
||||
"""Internal Claim Control Number — unique MCS identifier."""
|
||||
|
||||
claim_type: str | None = None
|
||||
"""Claim type (2=Adjustment, 3=Claim)."""
|
||||
|
||||
hdr_from_dos: date | None = None
|
||||
"""Header From Date of Service — first day on billing statement."""
|
||||
|
||||
hdr_to_dos: date | None = None
|
||||
"""Header To Date of Service — last day on billing statement."""
|
||||
|
||||
tot_billed_amt: float | None = None
|
||||
"""Total billed amount — sum of all line item charges."""
|
||||
|
||||
claim_mbi: str | None = None
|
||||
"""Medicare Beneficiary Identifier."""
|
||||
|
||||
bene_last_1_6: str | None = None
|
||||
"""Beneficiary last name (first 6 characters)."""
|
||||
|
||||
bene_first_init: str | None = None
|
||||
"""Beneficiary first initial."""
|
||||
|
||||
bene_mid_init: str | None = None
|
||||
"""Beneficiary middle initial."""
|
||||
|
||||
bene_sex: str | None = None
|
||||
"""Beneficiary sex."""
|
||||
|
||||
bill_prov_npi: str | None = None
|
||||
"""Billing provider NPI number."""
|
||||
|
||||
bill_prov_ein: str | None = None
|
||||
"""Billing provider EIN/TIN."""
|
||||
|
||||
bill_prov_type: str | None = None
|
||||
"""Billing provider type code."""
|
||||
|
||||
bill_prov_spec: str | None = None
|
||||
"""Billing provider specialty code."""
|
||||
|
||||
diag_icd_type: str | None = None
|
||||
"""Diagnosis code qualifier (ICD-9 vs ICD-10)."""
|
||||
|
||||
diag_code: str | None = None
|
||||
"""Diagnosis code — primary and secondary."""
|
||||
|
||||
dtl_number: str | None = None
|
||||
"""Detail line sequence number (up to 52 lines)."""
|
||||
|
||||
dtl_from_date: date | None = None
|
||||
"""Line item starting date of service."""
|
||||
|
||||
dtl_to_date: date | None = None
|
||||
"""Line item ending date of service."""
|
||||
|
||||
proc_code: str | None = None
|
||||
"""HCPCS procedure code for the line item."""
|
||||
|
||||
mod_one: str | None = None
|
||||
"""First HCPCS procedure code modifier."""
|
||||
|
||||
mod_two: str | None = None
|
||||
"""Second HCPCS procedure code modifier."""
|
||||
|
||||
mod_three: str | None = None
|
||||
"""Third HCPCS procedure code modifier."""
|
||||
|
||||
mod_four: str | None = None
|
||||
"""Fourth HCPCS procedure code modifier."""
|
||||
|
||||
dtl_diag_icd_type: str | None = None
|
||||
"""Detail-level diagnosis ICD type (ICD-9 vs ICD-10)."""
|
||||
|
||||
dtl_primary_diag_code: str | None = None
|
||||
"""Primary diagnosis code supporting this line item."""
|
||||
|
||||
dtl_ndc: str | None = None
|
||||
"""Detail-level National Drug Code."""
|
||||
|
||||
ndc_unit_count: float | None = None
|
||||
"""NDC unit count."""
|
||||
|
||||
|
||||
class McsClaimResponse(SQLTable):
|
||||
"""Professional partially adjudicated claim response (MCS)."""
|
||||
|
||||
__schema__ = "bcda"
|
||||
__tablename__ = "mcs_claim_response"
|
||||
|
||||
icn: str | None = None
|
||||
"""Internal Claim Control Number — unique MCS identifier."""
|
||||
|
||||
claim_receipt_date: date | None = None
|
||||
"""Date the claim was received."""
|
||||
|
||||
status_code: str | None = None
|
||||
"""Current claim processing status."""
|
||||
|
||||
status_date: date | None = None
|
||||
"""Date the claim was placed in current status."""
|
||||
|
||||
claim_mbi: str | None = None
|
||||
"""Medicare Beneficiary Identifier."""
|
||||
|
||||
bene_last_1_6: str | None = None
|
||||
"""Beneficiary last name (first 6 characters)."""
|
||||
|
||||
bene_first_init: str | None = None
|
||||
"""Beneficiary first initial."""
|
||||
|
||||
bene_mid_init: str | None = None
|
||||
"""Beneficiary middle initial."""
|
||||
|
||||
bene_sex: str | None = None
|
||||
"""Beneficiary sex."""
|
||||
168
src/bcda/table/patient.py
Normal file
168
src/bcda/table/patient.py
Normal file
@@ -0,0 +1,168 @@
|
||||
"""FHIR R4 Patient resource — beneficiary demographics and identifiers.
|
||||
|
||||
Flattened from the BCDA v2 Patient ndjson export. One row per
|
||||
beneficiary. Maps CCLF8 (demographics) and CCLF9 (XREF) fields
|
||||
to their FHIR R4 element paths.
|
||||
|
||||
Source: ``/api/v2/Patient/$export`` bulk FHIR endpoint.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import date
|
||||
|
||||
from aco.table.base import SQLTable
|
||||
|
||||
|
||||
class Patient(SQLTable):
|
||||
"""FHIR R4 Patient resource — beneficiary demographics."""
|
||||
|
||||
__schema__ = "bcda"
|
||||
__tablename__ = "patient"
|
||||
|
||||
# ── Resource metadata ────────────────────────────────────
|
||||
id: str | None = None
|
||||
"""FHIR resource ID (Patient.id) — same as bene_id."""
|
||||
|
||||
last_updated: str | None = None
|
||||
"""Resource last-updated timestamp (Patient.meta.lastUpdated)."""
|
||||
|
||||
# ── Identifiers ──────────────────────────────────────────
|
||||
bene_id: str | None = None
|
||||
"""Unique CCW beneficiary identifier (Patient.identifier).
|
||||
BCDA-only — not in CCLF."""
|
||||
|
||||
bene_mbi_id: str | None = None
|
||||
"""Medicare Beneficiary Identifier (Patient.identifier).
|
||||
Discriminated by system='http://hl7.org/fhir/sid/us-mbi'."""
|
||||
|
||||
identifier_currency: str | None = None
|
||||
"""MBI currency indicator — 'current' or 'historic'
|
||||
(Patient.identifier.type.coding.extension valueCoding)."""
|
||||
|
||||
hicn_mbi_xref_ind: str | None = None
|
||||
"""XREF indicator — 'M' for MBI (Patient.identifier.system)."""
|
||||
|
||||
crnt_num: str | None = None
|
||||
"""Current beneficiary MBI (Patient.identifier.value)."""
|
||||
|
||||
prvs_num: str | None = None
|
||||
"""Previous beneficiary MBI (Patient.identifier.value)."""
|
||||
|
||||
efctv_bgn_dt: date | None = None
|
||||
"""Previous identifier effective date (Patient.identifier.period.start).
|
||||
BCDA-only — not in CCLF."""
|
||||
|
||||
efctv_end_dt: date | None = None
|
||||
"""Previous identifier obsolete date (Patient.identifier.period.end).
|
||||
BCDA-only — not in CCLF."""
|
||||
|
||||
# ── Demographics ─────────────────────────────────────────
|
||||
bene_1st_name: str | None = None
|
||||
"""First name (Patient.name.given[0])."""
|
||||
|
||||
bene_midl_name: str | None = None
|
||||
"""Middle name (Patient.name.given[1])."""
|
||||
|
||||
bene_last_name: str | None = None
|
||||
"""Last name (Patient.name.family)."""
|
||||
|
||||
bene_dob: date | None = None
|
||||
"""Date of birth (Patient.birthDate)."""
|
||||
|
||||
bene_sex_cd: str | None = None
|
||||
"""Sex code (Patient.gender)."""
|
||||
|
||||
us_core_sex: str | None = None
|
||||
"""US Core sex extension code
|
||||
(Patient.extension[us-core-sex] valueCode)."""
|
||||
|
||||
bene_race_cd: str | None = None
|
||||
"""Race code — BlueButton extension
|
||||
(Patient.extension[race] valueCoding)."""
|
||||
|
||||
us_core_race: str | None = None
|
||||
"""US Core race OMB category code
|
||||
(Patient.extension[us-core-race] valueCoding)."""
|
||||
|
||||
bene_death_dt: date | None = None
|
||||
"""Date of death (Patient.deceasedDateTime)."""
|
||||
|
||||
rfrnc_yr: str | None = None
|
||||
"""Reference year for the beneficiary record
|
||||
(Patient.extension[rfrnc_yr] valueDate)."""
|
||||
|
||||
# ── Address ──────────────────────────────────────────────
|
||||
bene_fips_state_cd: str | None = None
|
||||
"""FIPS state code (Patient.address.state)."""
|
||||
|
||||
bene_zip_cd: str | None = None
|
||||
"""ZIP code from enrollment record (Patient.address.postalCode)."""
|
||||
|
||||
bene_line_1_adr: str | None = None
|
||||
"""Street address line 1 (Patient.address.line[0])."""
|
||||
|
||||
bene_line_2_adr: str | None = None
|
||||
"""Street address line 2 (Patient.address.line[1])."""
|
||||
|
||||
bene_line_3_adr: str | None = None
|
||||
"""Street address line 3 (Patient.address.line[2])."""
|
||||
|
||||
bene_line_4_adr: str | None = None
|
||||
"""Street address line 4 (Patient.address.line[3])."""
|
||||
|
||||
bene_line_5_adr: str | None = None
|
||||
"""Street address line 5 (Patient.address.line[4])."""
|
||||
|
||||
bene_line_6_adr: str | None = None
|
||||
"""Street address line 6 (Patient.address.line[5])."""
|
||||
|
||||
geo_zip_plc_name: str | None = None
|
||||
"""City name (Patient.address.city)."""
|
||||
|
||||
geo_usps_state_cd: str | None = None
|
||||
"""USPS state code (Patient.address.state)."""
|
||||
|
||||
geo_zip5_cd: str | None = None
|
||||
"""5-digit ZIP (Patient.address.postalCode)."""
|
||||
|
||||
geo_zip4_cd: str | None = None
|
||||
"""ZIP+4 extension (Patient.address.postalCode)."""
|
||||
|
||||
# ── Monthly dual eligibility (also on Coverage) ──────────
|
||||
dual_01: str | None = None
|
||||
"""Dual eligibility status — January
|
||||
(Patient.extension[dual_01] valueCoding)."""
|
||||
|
||||
dual_02: str | None = None
|
||||
"""Dual eligibility status — February."""
|
||||
|
||||
dual_03: str | None = None
|
||||
"""Dual eligibility status — March."""
|
||||
|
||||
dual_04: str | None = None
|
||||
"""Dual eligibility status — April."""
|
||||
|
||||
dual_05: str | None = None
|
||||
"""Dual eligibility status — May."""
|
||||
|
||||
dual_06: str | None = None
|
||||
"""Dual eligibility status — June."""
|
||||
|
||||
dual_07: str | None = None
|
||||
"""Dual eligibility status — July."""
|
||||
|
||||
dual_08: str | None = None
|
||||
"""Dual eligibility status — August."""
|
||||
|
||||
dual_09: str | None = None
|
||||
"""Dual eligibility status — September."""
|
||||
|
||||
dual_10: str | None = None
|
||||
"""Dual eligibility status — October."""
|
||||
|
||||
dual_11: str | None = None
|
||||
"""Dual eligibility status — November."""
|
||||
|
||||
dual_12: str | None = None
|
||||
"""Dual eligibility status — December."""
|
||||
@@ -1,34 +1,35 @@
|
||||
"""bib — Bibliography management via Zotero for healthcare data documentation.
|
||||
"""bib — Bibliography management for healthcare data documentation.
|
||||
|
||||
Wraps a local Zotero SQLite database or the Pyzotero Web API to keep
|
||||
clean, structured citations tied to every data source across the
|
||||
platform. Each module (``aco``, ``ccw``, ``pfs``, ``rex``) generates
|
||||
or consumes data from CMS publications — Federal Register rules, CMS
|
||||
manuals, eCFR regulations, and CMS download pages. ``bib`` keeps those
|
||||
provenance links in Zotero where they can be cited, searched, tagged,
|
||||
and shared.
|
||||
Owns a denormalized SQLite database for structured citations tied to
|
||||
every data source across the platform. Each module (``aco``, ``ccw``,
|
||||
``pfs``, ``rex``) generates or consumes data from CMS publications —
|
||||
Federal Register rules, CMS manuals, eCFR regulations, and CMS
|
||||
download pages. ``bib`` keeps those provenance links where they can
|
||||
be cited, searched, tagged, and shared.
|
||||
|
||||
Architecture
|
||||
------------
|
||||
|
||||
::
|
||||
|
||||
Zotero (local SQLite or Web API)
|
||||
SQLite (data/bib.sqlite)
|
||||
│
|
||||
▼
|
||||
┌───────────────────────────────────────────┐
|
||||
│ bib │
|
||||
│ context → LocalContext / RemoteContext │
|
||||
│ client → connect() + COLLECTIONS │
|
||||
│ item → Rule, Manual, Regulation, │
|
||||
│ Download, Source │
|
||||
│ tag → Tag (namespace:value) │
|
||||
│ translate → federal_register, cms_website,│
|
||||
│ cms_manual, ecfr │
|
||||
│ ingest → download + parse + attach │
|
||||
│ store → Store (CRUD, query, cite) │
|
||||
│ client → connect() + COLLECTIONS │
|
||||
│ item → Rule, Manual, Regulation, │
|
||||
│ Download, Source │
|
||||
│ tag → Tag (namespace:value) │
|
||||
│ format → APA / Bluebook formatting │
|
||||
│ translate → federal_register, cms_website│
|
||||
│ cms_manual, ecfr, four_i │
|
||||
│ ingest → download + parse + attach │
|
||||
│ ui → marimo widgets │
|
||||
└───────────────────────────────────────────┘
|
||||
│
|
||||
▼ Pydantic models + narwhals DataFrames
|
||||
▼ Pydantic models + polars DataFrames
|
||||
┌───────────────────────────┐
|
||||
│ aco / ccw / pfs / rex │
|
||||
└───────────────────────────┘
|
||||
@@ -40,31 +41,28 @@ Usage
|
||||
|
||||
from bib import connect, COLLECTIONS, Tag, Rule
|
||||
|
||||
# Local dev — SQLite, no network
|
||||
ctx = connect(database="zotero/data/zotero.sqlite")
|
||||
ctx.ensure_collections(COLLECTIONS)
|
||||
store = connect() # default: data/bib.sqlite
|
||||
store.ensure_collections(COLLECTIONS)
|
||||
|
||||
# Upsert a citation
|
||||
rule = Rule(title="CY 2026 PFS Final Rule", ...)
|
||||
ctx.upsert(rule, tags=[Tag.module("pfs"), Tag.year(2026)])
|
||||
rule = Rule(title="CY 2026 PFS Final Rule", fr_volume="90")
|
||||
store.upsert(rule, tags=[Tag.module("pfs"), Tag.year(2026)])
|
||||
|
||||
# Export to DataFrame
|
||||
df = ctx.to_dataframe(tag="module:pfs")
|
||||
|
||||
# Remote — Pyzotero Web API (reads env vars)
|
||||
ctx = connect()
|
||||
ctx.ensure_collections(COLLECTIONS)
|
||||
# Query
|
||||
items = store.list_items(tag="module:pfs")
|
||||
print(store.format_citation(items[0].key))
|
||||
"""
|
||||
|
||||
from .client import COLLECTIONS as COLLECTIONS
|
||||
from .client import connect as connect
|
||||
from .context import LocalContext as LocalContext
|
||||
from .context import RemoteContext as RemoteContext
|
||||
from .context import ZoteroContext as ZoteroContext
|
||||
from .ingest import ingest as ingest
|
||||
from .spider import crawl as crawl
|
||||
from .spider import crawl_all as crawl_all
|
||||
from .item import Download as Download
|
||||
from .item import Item as Item
|
||||
from .item import Manual as Manual
|
||||
from .item import Regulation as Regulation
|
||||
from .item import Rule as Rule
|
||||
from .item import Source as Source
|
||||
from .store import Store as Store
|
||||
from .tag import Tag as Tag
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
src/bib/__pycache__/format.cpython-313.pyc
Normal file
BIN
src/bib/__pycache__/format.cpython-313.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
src/bib/__pycache__/spider.cpython-313.pyc
Normal file
BIN
src/bib/__pycache__/spider.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bib/__pycache__/store.cpython-313.pyc
Normal file
BIN
src/bib/__pycache__/store.cpython-313.pyc
Normal file
Binary file not shown.
BIN
src/bib/__pycache__/sync.cpython-313.pyc
Normal file
BIN
src/bib/__pycache__/sync.cpython-313.pyc
Normal file
Binary file not shown.
Binary file not shown.
@@ -1,29 +1,16 @@
|
||||
"""Zotero connection factory and collection hierarchy.
|
||||
|
||||
The ``connect()`` function returns the right context based on what
|
||||
you give it:
|
||||
|
||||
- Pass a ``database`` path → ``LocalContext`` (SQLite, no network)
|
||||
- Pass nothing → ``RemoteContext`` (Pyzotero Web API from env vars)
|
||||
"""Connection factory and collection hierarchy.
|
||||
|
||||
Usage::
|
||||
|
||||
from bib import connect, COLLECTIONS
|
||||
|
||||
# Local dev
|
||||
ctx = connect(database="zotero/data/zotero.sqlite")
|
||||
ctx.ensure_collections(COLLECTIONS)
|
||||
|
||||
# Remote (reads ZOTERO_LIBRARY_ID, ZOTERO_API_KEY from env)
|
||||
ctx = connect()
|
||||
ctx.ensure_collections(COLLECTIONS)
|
||||
store = connect() # default: data/bib.sqlite
|
||||
store.ensure_collections(COLLECTIONS)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
|
||||
from bib.context import LocalContext, RemoteContext, ZoteroContext
|
||||
from bib.store import Store
|
||||
|
||||
# ── Module-level collection hierarchy ────────────────────────────
|
||||
|
||||
@@ -51,40 +38,18 @@ COLLECTIONS = {
|
||||
}
|
||||
|
||||
|
||||
def connect(
|
||||
*,
|
||||
database: str = "",
|
||||
library_id: str = "",
|
||||
library_type: str = "",
|
||||
api_key: str = "",
|
||||
) -> ZoteroContext:
|
||||
"""Return a context — local or remote.
|
||||
def connect(database: str = "data/bib.sqlite") -> Store:
|
||||
"""Return a Store backed by the given SQLite database.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
database : str
|
||||
Path to a local ``zotero.sqlite`` file. When provided,
|
||||
returns a ``LocalContext`` that operates directly on SQLite.
|
||||
library_id : str
|
||||
Zotero library ID (for remote). Falls back to
|
||||
``ZOTERO_LIBRARY_ID`` env var.
|
||||
library_type : str
|
||||
``"user"`` or ``"group"`` (for remote). Falls back to
|
||||
``ZOTERO_LIBRARY_TYPE`` env var (default ``"user"``).
|
||||
api_key : str
|
||||
Zotero API key (for remote). Falls back to
|
||||
``ZOTERO_API_KEY`` env var.
|
||||
Path to the SQLite file. Defaults to ``data/bib.sqlite``.
|
||||
Use ``":memory:"`` for in-memory operation.
|
||||
|
||||
Returns
|
||||
-------
|
||||
ZoteroContext
|
||||
A ``LocalContext`` or ``RemoteContext``.
|
||||
Store
|
||||
A ready-to-use bibliography store.
|
||||
"""
|
||||
if database:
|
||||
return LocalContext(database=database)
|
||||
|
||||
return RemoteContext(
|
||||
library_id=library_id or os.environ.get("ZOTERO_LIBRARY_ID", ""),
|
||||
library_type=library_type or os.environ.get("ZOTERO_LIBRARY_TYPE", "user"),
|
||||
api_key=api_key or os.environ.get("ZOTERO_API_KEY", ""),
|
||||
)
|
||||
return Store(database)
|
||||
|
||||
@@ -1,660 +0,0 @@
|
||||
"""Context-aware Zotero backends — local SQLite or remote Web API.
|
||||
|
||||
Mirrors the ``aco.lake.context`` pattern: a base ``ZoteroContext``
|
||||
with ``LocalContext`` (reads/writes ``zotero.sqlite`` directly) and
|
||||
``RemoteContext`` (wraps Pyzotero Web API).
|
||||
|
||||
Usage::
|
||||
|
||||
from bib import connect
|
||||
|
||||
# Local dev — SQLite, no network
|
||||
ctx = connect(database="zotero/data/zotero.sqlite")
|
||||
|
||||
# Remote — Pyzotero Web API (reads env vars)
|
||||
ctx = connect()
|
||||
|
||||
# Both expose the same interface
|
||||
ctx.ensure_collections(COLLECTIONS)
|
||||
ctx.upsert(rule, tags=[Tag.module("pfs")])
|
||||
df = ctx.to_dataframe(tag="module:pfs")
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import random
|
||||
import sqlite3
|
||||
import string
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
import narwhals as nw
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from bib.item import _ZoteroItem
|
||||
from bib.tag import Tag
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Base
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class ZoteroContext(BaseModel):
|
||||
"""Abstract Zotero backend — local or remote."""
|
||||
|
||||
model_config = ConfigDict(arbitrary_types_allowed=True)
|
||||
|
||||
def list_collections(self) -> list[dict[str, Any]]:
|
||||
raise NotImplementedError
|
||||
|
||||
def ensure_collections(
|
||||
self,
|
||||
hierarchy: dict[str, dict],
|
||||
parent: str | None = None,
|
||||
) -> dict[str, str]:
|
||||
raise NotImplementedError
|
||||
|
||||
def upsert(
|
||||
self,
|
||||
item: _ZoteroItem,
|
||||
*,
|
||||
tags: list[Tag] | None = None,
|
||||
collection: str = "",
|
||||
) -> str:
|
||||
raise NotImplementedError
|
||||
|
||||
def list_items(
|
||||
self,
|
||||
*,
|
||||
tag: str = "",
|
||||
item_type: str = "",
|
||||
collection: str = "",
|
||||
) -> list[dict[str, Any]]:
|
||||
raise NotImplementedError
|
||||
|
||||
def to_dataframe(
|
||||
self,
|
||||
*,
|
||||
tag: str = "",
|
||||
item_type: str = "",
|
||||
collection: str = "",
|
||||
) -> nw.DataFrame:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Local — direct SQLite
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def _generate_key() -> str:
|
||||
"""8-char alphanumeric key matching Zotero's format."""
|
||||
chars = string.ascii_uppercase + string.digits
|
||||
return "".join(random.choices(chars, k=8)) # noqa: S311
|
||||
|
||||
|
||||
class LocalContext(ZoteroContext):
|
||||
"""Read/write a local Zotero SQLite database directly.
|
||||
|
||||
No pyzotero dependency. Operates on the same ``zotero.sqlite``
|
||||
file that the Zotero desktop app (or container) uses.
|
||||
"""
|
||||
|
||||
database: str
|
||||
"""Path to ``zotero.sqlite``."""
|
||||
|
||||
library_id: int = 1
|
||||
"""Library ID (1 = default local library)."""
|
||||
|
||||
_connection: Any = None
|
||||
|
||||
def _con(self) -> sqlite3.Connection:
|
||||
if self._connection is None:
|
||||
self._connection = sqlite3.connect(self.database)
|
||||
self._connection.row_factory = sqlite3.Row
|
||||
return self._connection
|
||||
|
||||
# ── field / type lookups ─────────────────────────────────────
|
||||
|
||||
def _field_id(self, name: str) -> int:
|
||||
row = (
|
||||
self._con()
|
||||
.execute("SELECT fieldID FROM fields WHERE fieldName = ?", (name,))
|
||||
.fetchone()
|
||||
)
|
||||
if row is None:
|
||||
raise ValueError(f"Unknown Zotero field: {name}")
|
||||
return row["fieldID"]
|
||||
|
||||
def _item_type_id(self, name: str) -> int:
|
||||
row = (
|
||||
self._con()
|
||||
.execute("SELECT itemTypeID FROM itemTypes WHERE typeName = ?", (name,))
|
||||
.fetchone()
|
||||
)
|
||||
if row is None:
|
||||
raise ValueError(f"Unknown Zotero item type: {name}")
|
||||
return row["itemTypeID"]
|
||||
|
||||
# ── value storage (3-table pattern) ──────────────────────────
|
||||
|
||||
def _value_id(self, value: str) -> int:
|
||||
"""Find or create an itemDataValues row, return valueID."""
|
||||
con = self._con()
|
||||
row = con.execute(
|
||||
"SELECT valueID FROM itemDataValues WHERE value = ?", (value,)
|
||||
).fetchone()
|
||||
if row:
|
||||
return row["valueID"]
|
||||
cur = con.execute("INSERT INTO itemDataValues (value) VALUES (?)", (value,))
|
||||
return cur.lastrowid # type: ignore[return-value]
|
||||
|
||||
def _set_field(self, item_id: int, field_name: str, value: str) -> None:
|
||||
"""Upsert a metadata field on an item."""
|
||||
if not value:
|
||||
return
|
||||
con = self._con()
|
||||
fid = self._field_id(field_name)
|
||||
vid = self._value_id(value)
|
||||
existing = con.execute(
|
||||
"SELECT valueID FROM itemData WHERE itemID = ? AND fieldID = ?",
|
||||
(item_id, fid),
|
||||
).fetchone()
|
||||
if existing:
|
||||
con.execute(
|
||||
"UPDATE itemData SET valueID = ? WHERE itemID = ? AND fieldID = ?",
|
||||
(vid, item_id, fid),
|
||||
)
|
||||
else:
|
||||
con.execute(
|
||||
"INSERT INTO itemData (itemID, fieldID, valueID) VALUES (?, ?, ?)",
|
||||
(item_id, fid, vid),
|
||||
)
|
||||
|
||||
# ── read an item back as Zotero-API-compatible dict ──────────
|
||||
|
||||
def _item_to_dict(self, item_id: int) -> dict[str, Any]:
|
||||
"""Reconstruct a Zotero API dict from the normalised SQLite tables."""
|
||||
con = self._con()
|
||||
|
||||
item_row = con.execute(
|
||||
"""SELECT i.key, i.version, it.typeName
|
||||
FROM items i
|
||||
JOIN itemTypes it ON i.itemTypeID = it.itemTypeID
|
||||
WHERE i.itemID = ?""",
|
||||
(item_id,),
|
||||
).fetchone()
|
||||
if item_row is None:
|
||||
raise ValueError(f"Item {item_id} not found")
|
||||
|
||||
d: dict[str, Any] = {
|
||||
"key": item_row["key"],
|
||||
"version": item_row["version"],
|
||||
"itemType": item_row["typeName"],
|
||||
}
|
||||
|
||||
# Fields
|
||||
for row in con.execute(
|
||||
"""SELECT f.fieldName, idv.value
|
||||
FROM itemData id
|
||||
JOIN fields f ON id.fieldID = f.fieldID
|
||||
JOIN itemDataValues idv ON id.valueID = idv.valueID
|
||||
WHERE id.itemID = ?""",
|
||||
(item_id,),
|
||||
).fetchall():
|
||||
d[row["fieldName"]] = row["value"]
|
||||
|
||||
# Tags
|
||||
d["tags"] = [
|
||||
{"tag": row["name"], "type": row["type"]}
|
||||
for row in con.execute(
|
||||
"""SELECT t.name, it.type
|
||||
FROM itemTags it
|
||||
JOIN tags t ON it.tagID = t.tagID
|
||||
WHERE it.itemID = ?""",
|
||||
(item_id,),
|
||||
).fetchall()
|
||||
]
|
||||
|
||||
# Collections (as keys)
|
||||
d["collections"] = [
|
||||
row["key"]
|
||||
for row in con.execute(
|
||||
"""SELECT c.key
|
||||
FROM collectionItems ci
|
||||
JOIN collections c ON ci.collectionID = c.collectionID
|
||||
WHERE ci.itemID = ?""",
|
||||
(item_id,),
|
||||
).fetchall()
|
||||
]
|
||||
|
||||
return {"data": d}
|
||||
|
||||
# ── collections ──────────────────────────────────────────────
|
||||
|
||||
def list_collections(self) -> list[dict[str, Any]]:
|
||||
con = self._con()
|
||||
results = []
|
||||
for row in con.execute(
|
||||
"""SELECT c.collectionID, c.collectionName, c.key,
|
||||
c.parentCollectionID,
|
||||
pc.key AS parent_key,
|
||||
(SELECT count(*) FROM collectionItems ci
|
||||
WHERE ci.collectionID = c.collectionID) AS item_count
|
||||
FROM collections c
|
||||
LEFT JOIN collections pc
|
||||
ON c.parentCollectionID = pc.collectionID
|
||||
WHERE c.libraryID = ?
|
||||
ORDER BY c.collectionName""",
|
||||
(self.library_id,),
|
||||
).fetchall():
|
||||
results.append(
|
||||
{
|
||||
"key": row["key"],
|
||||
"name": row["collectionName"],
|
||||
"parent_key": row["parent_key"] or "",
|
||||
"item_count": row["item_count"],
|
||||
}
|
||||
)
|
||||
return results
|
||||
|
||||
def ensure_collections(
|
||||
self,
|
||||
hierarchy: dict[str, dict],
|
||||
parent: str | None = None,
|
||||
) -> dict[str, str]:
|
||||
con = self._con()
|
||||
result: dict[str, str] = {}
|
||||
|
||||
# Resolve parent collectionID from key
|
||||
parent_id: int | None = None
|
||||
if parent:
|
||||
row = con.execute(
|
||||
"SELECT collectionID FROM collections WHERE key = ? AND libraryID = ?",
|
||||
(parent, self.library_id),
|
||||
).fetchone()
|
||||
if row:
|
||||
parent_id = row["collectionID"]
|
||||
|
||||
for name, children in hierarchy.items():
|
||||
# Check if exists
|
||||
if parent_id is not None:
|
||||
row = con.execute(
|
||||
"""SELECT collectionID, key FROM collections
|
||||
WHERE collectionName = ? AND libraryID = ?
|
||||
AND parentCollectionID = ?""",
|
||||
(name, self.library_id, parent_id),
|
||||
).fetchone()
|
||||
else:
|
||||
row = con.execute(
|
||||
"""SELECT collectionID, key FROM collections
|
||||
WHERE collectionName = ? AND libraryID = ?
|
||||
AND parentCollectionID IS NULL""",
|
||||
(name, self.library_id),
|
||||
).fetchone()
|
||||
|
||||
if row:
|
||||
key = row["key"]
|
||||
else:
|
||||
key = _generate_key()
|
||||
con.execute(
|
||||
"""INSERT INTO collections
|
||||
(collectionName, parentCollectionID, libraryID, key, version)
|
||||
VALUES (?, ?, ?, ?, 0)""",
|
||||
(name, parent_id, self.library_id, key),
|
||||
)
|
||||
|
||||
result[name] = key
|
||||
|
||||
if children:
|
||||
child_map = self.ensure_collections(children, parent=key)
|
||||
result.update(child_map)
|
||||
|
||||
con.commit()
|
||||
return result
|
||||
|
||||
# ── items ────────────────────────────────────────────────────
|
||||
|
||||
def _find_by_url(self, url: str) -> int | None:
|
||||
"""Find item ID by URL, or None."""
|
||||
if not url:
|
||||
return None
|
||||
row = (
|
||||
self._con()
|
||||
.execute(
|
||||
"""SELECT id.itemID FROM itemData id
|
||||
JOIN fields f ON id.fieldID = f.fieldID
|
||||
JOIN itemDataValues idv ON id.valueID = idv.valueID
|
||||
WHERE f.fieldName = 'url' AND idv.value = ?""",
|
||||
(url,),
|
||||
)
|
||||
.fetchone()
|
||||
)
|
||||
return row["itemID"] if row else None
|
||||
|
||||
def _ensure_tag(self, name: str) -> int:
|
||||
"""Find or create a tag, return tagID."""
|
||||
con = self._con()
|
||||
row = con.execute("SELECT tagID FROM tags WHERE name = ?", (name,)).fetchone()
|
||||
if row:
|
||||
return row["tagID"]
|
||||
cur = con.execute("INSERT INTO tags (name) VALUES (?)", (name,))
|
||||
return cur.lastrowid # type: ignore[return-value]
|
||||
|
||||
def _sync_tags(self, item_id: int, tag_dicts: list[dict]) -> None:
|
||||
"""Set item tags to exactly the given list."""
|
||||
con = self._con()
|
||||
con.execute("DELETE FROM itemTags WHERE itemID = ?", (item_id,))
|
||||
for td in tag_dicts:
|
||||
tag_name = td.get("tag", "")
|
||||
if not tag_name:
|
||||
continue
|
||||
tag_id = self._ensure_tag(tag_name)
|
||||
tag_type = td.get("type", 0)
|
||||
con.execute(
|
||||
"INSERT OR IGNORE INTO itemTags (itemID, tagID, type) VALUES (?, ?, ?)",
|
||||
(item_id, tag_id, tag_type),
|
||||
)
|
||||
|
||||
def _sync_collections(self, item_id: int, collection_keys: list[str]) -> None:
|
||||
"""Set item collection membership to exactly the given keys."""
|
||||
con = self._con()
|
||||
con.execute("DELETE FROM collectionItems WHERE itemID = ?", (item_id,))
|
||||
for ckey in collection_keys:
|
||||
row = con.execute(
|
||||
"SELECT collectionID FROM collections WHERE key = ?", (ckey,)
|
||||
).fetchone()
|
||||
if row:
|
||||
con.execute(
|
||||
"INSERT OR IGNORE INTO collectionItems "
|
||||
"(collectionID, itemID, orderIndex) VALUES (?, ?, 0)",
|
||||
(row["collectionID"], item_id),
|
||||
)
|
||||
|
||||
def upsert(
|
||||
self,
|
||||
item: _ZoteroItem,
|
||||
*,
|
||||
tags: list[Tag] | None = None,
|
||||
collection: str = "",
|
||||
) -> str:
|
||||
if tags:
|
||||
for tag in tags:
|
||||
item.add_tag(tag.label)
|
||||
if collection and collection not in item.collections:
|
||||
item.collections.append(collection)
|
||||
|
||||
item.stamp_access()
|
||||
zd = item.to_zotero()
|
||||
|
||||
con = self._con()
|
||||
item_type = zd.pop("itemType", "document")
|
||||
type_id = self._item_type_id(item_type)
|
||||
tag_dicts = zd.pop("tags", [])
|
||||
col_keys = zd.pop("collections", [])
|
||||
|
||||
# Dedup by URL
|
||||
existing_id = self._find_by_url(zd.get("url", ""))
|
||||
|
||||
if existing_id is not None:
|
||||
# Update fields
|
||||
for field_name, value in zd.items():
|
||||
if value:
|
||||
self._set_field(existing_id, field_name, str(value))
|
||||
self._sync_tags(existing_id, tag_dicts)
|
||||
self._sync_collections(existing_id, col_keys)
|
||||
con.commit()
|
||||
row = con.execute(
|
||||
"SELECT key FROM items WHERE itemID = ?", (existing_id,)
|
||||
).fetchone()
|
||||
return row["key"]
|
||||
|
||||
# Create new item
|
||||
key = _generate_key()
|
||||
cur = con.execute(
|
||||
"""INSERT INTO items (itemTypeID, libraryID, key, version)
|
||||
VALUES (?, ?, ?, 0)""",
|
||||
(type_id, self.library_id, key),
|
||||
)
|
||||
new_id = cur.lastrowid
|
||||
|
||||
for field_name, value in zd.items():
|
||||
if value:
|
||||
self._set_field(new_id, field_name, str(value))
|
||||
|
||||
self._sync_tags(new_id, tag_dicts)
|
||||
self._sync_collections(new_id, col_keys)
|
||||
con.commit()
|
||||
return key
|
||||
|
||||
# ── query ────────────────────────────────────────────────────
|
||||
|
||||
def list_items(
|
||||
self,
|
||||
*,
|
||||
tag: str = "",
|
||||
item_type: str = "",
|
||||
collection: str = "",
|
||||
) -> list[dict[str, Any]]:
|
||||
con = self._con()
|
||||
|
||||
# Get non-deleted, non-attachment/note item IDs
|
||||
base = """
|
||||
SELECT DISTINCT i.itemID
|
||||
FROM items i
|
||||
JOIN itemTypes it ON i.itemTypeID = it.itemTypeID
|
||||
WHERE i.libraryID = ?
|
||||
AND i.itemID NOT IN (SELECT itemID FROM deletedItems)
|
||||
AND it.typeName NOT IN ('attachment', 'note')
|
||||
"""
|
||||
params: list[Any] = [self.library_id]
|
||||
|
||||
if item_type:
|
||||
base += " AND it.typeName = ?"
|
||||
params.append(item_type)
|
||||
if tag:
|
||||
base += """
|
||||
AND i.itemID IN (
|
||||
SELECT it2.itemID FROM itemTags it2
|
||||
JOIN tags t ON it2.tagID = t.tagID
|
||||
WHERE t.name = ?
|
||||
)"""
|
||||
params.append(tag)
|
||||
if collection:
|
||||
base += """
|
||||
AND i.itemID IN (
|
||||
SELECT ci.itemID FROM collectionItems ci
|
||||
JOIN collections c ON ci.collectionID = c.collectionID
|
||||
WHERE c.key = ?
|
||||
)"""
|
||||
params.append(collection)
|
||||
|
||||
rows = con.execute(base, params).fetchall()
|
||||
return [self._item_to_dict(row["itemID"]) for row in rows]
|
||||
|
||||
def to_dataframe(
|
||||
self,
|
||||
*,
|
||||
tag: str = "",
|
||||
item_type: str = "",
|
||||
collection: str = "",
|
||||
) -> nw.DataFrame:
|
||||
import polars as pl
|
||||
|
||||
items = self.list_items(tag=tag, item_type=item_type, collection=collection)
|
||||
|
||||
rows = []
|
||||
for item in items:
|
||||
d = item.get("data", {})
|
||||
title = d.get("title") or d.get("nameOfAct") or ""
|
||||
tag_labels = [t["tag"] for t in d.get("tags", []) if "tag" in t]
|
||||
rows.append(
|
||||
{
|
||||
"key": d.get("key", ""),
|
||||
"item_type": d.get("itemType", ""),
|
||||
"title": title,
|
||||
"url": d.get("url", ""),
|
||||
"date": d.get("date") or d.get("dateEnacted") or "",
|
||||
"tags": "; ".join(tag_labels),
|
||||
"collections": "; ".join(d.get("collections", [])),
|
||||
}
|
||||
)
|
||||
|
||||
return nw.from_native(pl.DataFrame(rows), eager_only=True)
|
||||
|
||||
def __del__(self) -> None:
|
||||
if self._connection is not None:
|
||||
try:
|
||||
self._connection.close()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Remote — Pyzotero Web API
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class RemoteContext(ZoteroContext):
|
||||
"""Zotero Web API via pyzotero.
|
||||
|
||||
Requires ``pyzotero`` to be installed — imported lazily inside
|
||||
methods so the package is only needed when ``RemoteContext`` is
|
||||
actually used.
|
||||
"""
|
||||
|
||||
library_id: str = ""
|
||||
library_type: str = "user"
|
||||
api_key: str = ""
|
||||
|
||||
_client: Any = None
|
||||
|
||||
def _zot(self) -> Any:
|
||||
if self._client is None:
|
||||
from pyzotero import zotero
|
||||
|
||||
if not self.library_id or not self.api_key:
|
||||
raise ValueError("RemoteContext requires library_id and api_key")
|
||||
self._client = zotero.Zotero(
|
||||
self.library_id, self.library_type, self.api_key
|
||||
)
|
||||
return self._client
|
||||
|
||||
def list_collections(self) -> list[dict[str, Any]]:
|
||||
zot = self._zot()
|
||||
return [
|
||||
{
|
||||
"key": c["data"]["key"],
|
||||
"name": c["data"]["name"],
|
||||
"parent_key": c["data"].get("parentCollection", ""),
|
||||
"item_count": c["meta"].get("numItems", 0),
|
||||
}
|
||||
for c in zot.collections()
|
||||
]
|
||||
|
||||
def ensure_collections(
|
||||
self,
|
||||
hierarchy: dict[str, dict],
|
||||
parent: str | None = None,
|
||||
) -> dict[str, str]:
|
||||
zot = self._zot()
|
||||
existing = {c["data"]["name"]: c["data"]["key"] for c in zot.collections()}
|
||||
result: dict[str, str] = {}
|
||||
|
||||
for name, children in hierarchy.items():
|
||||
if name in existing:
|
||||
key = existing[name]
|
||||
else:
|
||||
payload: dict[str, Any] = {"name": name}
|
||||
if parent:
|
||||
payload["parentCollection"] = parent
|
||||
resp = zot.create_collections([payload])
|
||||
key = resp["successful"]["0"]["data"]["key"]
|
||||
|
||||
result[name] = key
|
||||
|
||||
if children:
|
||||
child_map = self.ensure_collections(children, parent=key)
|
||||
result.update(child_map)
|
||||
|
||||
return result
|
||||
|
||||
def upsert(
|
||||
self,
|
||||
item: _ZoteroItem,
|
||||
*,
|
||||
tags: list[Tag] | None = None,
|
||||
collection: str = "",
|
||||
) -> str:
|
||||
zot = self._zot()
|
||||
|
||||
if tags:
|
||||
for tag in tags:
|
||||
item.add_tag(tag.label)
|
||||
if collection and collection not in item.collections:
|
||||
item.collections.append(collection)
|
||||
|
||||
item.stamp_access()
|
||||
zotero_dict = item.to_zotero()
|
||||
|
||||
# Dedup by URL
|
||||
if item.url:
|
||||
existing = zot.items(q=item.url, qmode="everything")
|
||||
for ex in existing:
|
||||
ex_url = ex.get("data", {}).get("url", "")
|
||||
if ex_url == item.url:
|
||||
ex["data"].update(zotero_dict)
|
||||
zot.update_item(ex)
|
||||
return ex["data"]["key"]
|
||||
|
||||
resp = zot.create_items([zotero_dict])
|
||||
return resp["success"]["0"]
|
||||
|
||||
def list_items(
|
||||
self,
|
||||
*,
|
||||
tag: str = "",
|
||||
item_type: str = "",
|
||||
collection: str = "",
|
||||
) -> list[dict[str, Any]]:
|
||||
zot = self._zot()
|
||||
kwargs: dict[str, Any] = {}
|
||||
if tag:
|
||||
kwargs["tag"] = tag
|
||||
if item_type:
|
||||
kwargs["itemType"] = item_type
|
||||
|
||||
if collection:
|
||||
return zot.everything(zot.collection_items(collection, **kwargs))
|
||||
return zot.everything(zot.top(**kwargs))
|
||||
|
||||
def to_dataframe(
|
||||
self,
|
||||
*,
|
||||
tag: str = "",
|
||||
item_type: str = "",
|
||||
collection: str = "",
|
||||
) -> nw.DataFrame:
|
||||
import polars as pl
|
||||
|
||||
items = self.list_items(tag=tag, item_type=item_type, collection=collection)
|
||||
|
||||
rows = []
|
||||
for item in items:
|
||||
d = item.get("data", {})
|
||||
title = d.get("title") or d.get("nameOfAct") or ""
|
||||
tag_labels = [t["tag"] for t in d.get("tags", []) if "tag" in t]
|
||||
rows.append(
|
||||
{
|
||||
"key": d.get("key", ""),
|
||||
"item_type": d.get("itemType", ""),
|
||||
"title": title,
|
||||
"url": d.get("url", ""),
|
||||
"date": d.get("date") or d.get("dateEnacted") or "",
|
||||
"tags": "; ".join(tag_labels),
|
||||
"collections": "; ".join(d.get("collections", [])),
|
||||
}
|
||||
)
|
||||
|
||||
return nw.from_native(pl.DataFrame(rows), eager_only=True)
|
||||
180
src/bib/format.py
Normal file
180
src/bib/format.py
Normal file
@@ -0,0 +1,180 @@
|
||||
"""Citation formatting for government/regulatory item types.
|
||||
|
||||
Hardcoded formatters for the 5 item types — no CSL dependency needed
|
||||
since these follow predictable patterns.
|
||||
|
||||
Supported styles:
|
||||
|
||||
- ``apa`` — APA 7th edition (default)
|
||||
- ``bluebook`` — Bluebook legal citation (regulations only)
|
||||
|
||||
Examples::
|
||||
|
||||
Rule (APA):
|
||||
Centers for Medicare & Medicaid Services. (2025).
|
||||
CY 2026 PFS Final Rule. *Federal Register*, *90*, 98452.
|
||||
|
||||
Manual (APA):
|
||||
Centers for Medicare & Medicaid Services. (n.d.).
|
||||
*Claims Processing Manual* (Pub. 100-04, Ch. 12).
|
||||
|
||||
Regulation (Bluebook):
|
||||
42 C.F.R. § 414.22 (2025).
|
||||
|
||||
Download (APA):
|
||||
Centers for Medicare & Medicaid Services. (2026).
|
||||
*RVU26A*. https://...
|
||||
|
||||
Source (APA):
|
||||
CMS Innovation Center. (2025).
|
||||
*PY 2026 Financial Guarantees...*. https://...
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from bib.item import (
|
||||
Download,
|
||||
Item,
|
||||
Manual,
|
||||
Regulation,
|
||||
Rule,
|
||||
Source,
|
||||
)
|
||||
|
||||
|
||||
def format_citation(item: Item, *, style: str = "apa") -> str:
|
||||
"""Format a single item as a citation string."""
|
||||
formatters = {
|
||||
"rule": _format_rule,
|
||||
"manual": _format_manual,
|
||||
"regulation": _format_regulation,
|
||||
"download": _format_download,
|
||||
"source": _format_source,
|
||||
}
|
||||
fn = formatters.get(item.item_type, _format_generic)
|
||||
return fn(item, style=style)
|
||||
|
||||
|
||||
def format_bibliography(
|
||||
items: list[Item], *, style: str = "apa"
|
||||
) -> str:
|
||||
"""Format multiple items as a numbered bibliography."""
|
||||
lines = []
|
||||
for i, item in enumerate(items, 1):
|
||||
cite = format_citation(item, style=style)
|
||||
lines.append(f"[{i}] {cite}")
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
# ── Per-type formatters ──────────────────────────────────────────
|
||||
|
||||
|
||||
def _year_or_nd(date_str: str) -> str:
|
||||
"""Extract 4-digit year from an ISO date, or 'n.d.'."""
|
||||
if date_str and len(date_str) >= 4:
|
||||
return date_str[:4]
|
||||
return "n.d."
|
||||
|
||||
|
||||
def _format_rule(item: Rule, *, style: str = "apa") -> str:
|
||||
year = _year_or_nd(item.date_published)
|
||||
parts = [f"Centers for Medicare & Medicaid Services. ({year})."]
|
||||
parts.append(f"{item.title}.")
|
||||
|
||||
if item.fr_volume and item.fr_page:
|
||||
parts.append(
|
||||
f"*Federal Register*, *{item.fr_volume}*, {item.fr_page}."
|
||||
)
|
||||
elif item.fr_volume:
|
||||
parts.append(f"*Federal Register*, *{item.fr_volume}*.")
|
||||
|
||||
if item.url:
|
||||
parts.append(item.url)
|
||||
|
||||
return " ".join(parts)
|
||||
|
||||
|
||||
def _format_manual(item: Manual, *, style: str = "apa") -> str:
|
||||
year = _year_or_nd(item.date_published)
|
||||
institution = item.institution or "Centers for Medicare & Medicaid Services"
|
||||
parts = [f"{institution}. ({year})."]
|
||||
|
||||
title_part = f"*{item.manual_name}*" if item.manual_name else f"*{item.title}*"
|
||||
qualifiers = []
|
||||
if item.pub_number:
|
||||
qualifiers.append(f"Pub. {item.pub_number}")
|
||||
if item.chapter:
|
||||
qualifiers.append(f"Ch. {item.chapter}")
|
||||
if qualifiers:
|
||||
title_part += f" ({', '.join(qualifiers)})"
|
||||
parts.append(f"{title_part}.")
|
||||
|
||||
if item.url:
|
||||
parts.append(item.url)
|
||||
|
||||
return " ".join(parts)
|
||||
|
||||
|
||||
def _format_regulation(
|
||||
item: Regulation, *, style: str = "apa"
|
||||
) -> str:
|
||||
if style == "bluebook":
|
||||
year = _year_or_nd(item.effective_date)
|
||||
if item.cfr_section:
|
||||
return f"{item.cfr_title} C.F.R. § {item.cfr_section} ({year})."
|
||||
return f"{item.cfr_title} C.F.R. pt. {item.cfr_part} ({year})."
|
||||
|
||||
# APA
|
||||
year = _year_or_nd(item.effective_date)
|
||||
parts = []
|
||||
if item.cfr_section:
|
||||
parts.append(
|
||||
f"{item.cfr_title} C.F.R. § {item.cfr_section} ({year})."
|
||||
)
|
||||
else:
|
||||
parts.append(
|
||||
f"{item.cfr_title} C.F.R. pt. {item.cfr_part} ({year})."
|
||||
)
|
||||
if item.title and item.title != f"{item.cfr_title} CFR Part {item.cfr_part}":
|
||||
parts.append(f"*{item.title}*.")
|
||||
if item.url:
|
||||
parts.append(item.url)
|
||||
return " ".join(parts)
|
||||
|
||||
|
||||
def _format_download(item: Download, *, style: str = "apa") -> str:
|
||||
year = _year_or_nd(item.date_published)
|
||||
website = item.website_title or "Centers for Medicare & Medicaid Services"
|
||||
parts = [f"{website}. ({year})."]
|
||||
parts.append(f"*{item.title}*.")
|
||||
|
||||
if item.url:
|
||||
parts.append(item.url)
|
||||
|
||||
return " ".join(parts)
|
||||
|
||||
|
||||
def _format_source(item: Source, *, style: str = "apa") -> str:
|
||||
year = _year_or_nd(item.date_published)
|
||||
institution = item.institution or "Unknown"
|
||||
parts = [f"{institution}. ({year})."]
|
||||
parts.append(f"*{item.title}*.")
|
||||
|
||||
if item.url:
|
||||
parts.append(item.url)
|
||||
|
||||
return " ".join(parts)
|
||||
|
||||
|
||||
def _format_generic(item: Item, *, style: str = "apa") -> str:
|
||||
year = _year_or_nd(item.date_published)
|
||||
institution = item.institution or "Unknown"
|
||||
parts = [f"{institution}. ({year})."]
|
||||
if item.title:
|
||||
parts.append(f"*{item.title}*.")
|
||||
if item.url:
|
||||
parts.append(item.url)
|
||||
return " ".join(parts)
|
||||
@@ -1,24 +1,25 @@
|
||||
"""Download, parse, and attach files to Zotero records.
|
||||
"""Download, parse, and attach files to bibliography records.
|
||||
|
||||
Closes the citation loop: a ``bib.item.Download`` references a CMS
|
||||
page with file URLs → ``ingest()`` downloads those files, parses
|
||||
them via ``rex``, and attaches both the raw file and a summary note
|
||||
back to the Zotero item as children.
|
||||
back to the item as children.
|
||||
|
||||
Usage::
|
||||
|
||||
from bib import client, translate, ingest
|
||||
from bib.store import Store
|
||||
from bib import translate
|
||||
|
||||
zot = client.connect()
|
||||
store = Store("data/bib.sqlite")
|
||||
page = translate.cms_website(
|
||||
"https://www.cms.gov/.../rvu26a",
|
||||
module="pfs",
|
||||
)
|
||||
key = client.upsert(zot, page)
|
||||
key = store.upsert(page)
|
||||
|
||||
# Download files, parse, and attach to the Zotero record
|
||||
results = ingest.ingest(
|
||||
zot,
|
||||
# Download files, parse, and attach to the record
|
||||
results = ingest(
|
||||
store,
|
||||
item_key=key,
|
||||
download_dir=Path("data/pfs/2026"),
|
||||
format="pfs_rvu",
|
||||
@@ -27,11 +28,12 @@ Usage::
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pyzotero.zotero import Zotero
|
||||
from bib.store import Store
|
||||
|
||||
|
||||
def download_files(
|
||||
@@ -110,18 +112,18 @@ def extract_zip(path: Path, dest: Path | None = None) -> list[Path]:
|
||||
|
||||
|
||||
def attach_file(
|
||||
zot: Zotero,
|
||||
store: Store,
|
||||
item_key: str,
|
||||
path: Path,
|
||||
*,
|
||||
title: str = "",
|
||||
) -> str:
|
||||
"""Upload a file as a child attachment to a Zotero item.
|
||||
"""Copy a file into storage and link it to an item.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
zot : Zotero
|
||||
Connected Pyzotero client.
|
||||
store : Store
|
||||
Bibliography store.
|
||||
item_key : str
|
||||
Parent item key.
|
||||
path : Path
|
||||
@@ -132,100 +134,83 @@ def attach_file(
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
Attachment item key.
|
||||
Attachment key.
|
||||
"""
|
||||
zot.attachment_both(
|
||||
[(title or path.name, str(path))],
|
||||
parentid=item_key,
|
||||
)
|
||||
# Find the newly created attachment
|
||||
children = zot.children(item_key)
|
||||
for child in reversed(children):
|
||||
if child["data"].get("itemType") == "attachment":
|
||||
if child["data"].get("filename") == path.name:
|
||||
return child["data"]["key"]
|
||||
return ""
|
||||
return store.attach_file(item_key, path, title=title)
|
||||
|
||||
|
||||
def attach_note(
|
||||
zot: Zotero,
|
||||
store: Store,
|
||||
item_key: str,
|
||||
note_html: str,
|
||||
*,
|
||||
tags: list[dict[str, Any]] | None = None,
|
||||
) -> str:
|
||||
"""Add a child note to a Zotero item.
|
||||
title: str = "",
|
||||
) -> int:
|
||||
"""Add a note to an item.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
zot : Zotero
|
||||
Connected Pyzotero client.
|
||||
store : Store
|
||||
Bibliography store.
|
||||
item_key : str
|
||||
Parent item key.
|
||||
note_html : str
|
||||
Note content (HTML).
|
||||
tags : list[dict], optional
|
||||
Zotero-format tags for the note.
|
||||
title : str
|
||||
Optional note title.
|
||||
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
Note item key.
|
||||
int
|
||||
Note ID.
|
||||
"""
|
||||
template = zot.item_template("note")
|
||||
template["note"] = note_html
|
||||
if tags:
|
||||
template["tags"] = tags
|
||||
|
||||
resp = zot.create_items([template], parentid=item_key)
|
||||
return resp["success"].get("0", "")
|
||||
return store.attach_note(item_key, note_html, title=title)
|
||||
|
||||
|
||||
def ingest(
|
||||
zot: Zotero,
|
||||
store: Store,
|
||||
*,
|
||||
item_key: str,
|
||||
download_dir: Path,
|
||||
format: str = "",
|
||||
attach: bool = True,
|
||||
) -> dict[str, Any]:
|
||||
"""Download, parse, and attach files for a Zotero item.
|
||||
"""Download, parse, and attach files for an item.
|
||||
|
||||
Reads the item's child notes/extra field for file URLs (from
|
||||
a ``bib.item.Download``), downloads them, optionally parses
|
||||
Reads the item's ``extra_json`` for file URLs (from a
|
||||
``bib.item.Download``), downloads them, optionally parses
|
||||
via ``rex``, and attaches results back.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
zot : Zotero
|
||||
Connected Pyzotero client.
|
||||
store : Store
|
||||
Bibliography store.
|
||||
item_key : str
|
||||
Zotero item key for the Download record.
|
||||
Item key for the Download record.
|
||||
download_dir : Path
|
||||
Local directory for downloaded files.
|
||||
format : str, optional
|
||||
``rex`` format name for parsing (e.g. ``"pfs_rvu"``).
|
||||
If empty, files are attached without parsing.
|
||||
attach : bool
|
||||
If True, upload files as Zotero attachments.
|
||||
If True, copy files into storage as attachments.
|
||||
|
||||
Returns
|
||||
-------
|
||||
dict
|
||||
Summary with keys: ``files`` (downloaded paths),
|
||||
``extracted`` (parsed DataFrames if format given),
|
||||
``attachments`` (Zotero attachment keys).
|
||||
``attachments`` (attachment keys).
|
||||
"""
|
||||
# Get the item and extract file URLs from extra field
|
||||
item = zot.item(item_key)
|
||||
data = item.get("data", item)
|
||||
extra = data.get("extra", "")
|
||||
item = store.get(item_key)
|
||||
|
||||
# Get file URLs from extra_json (Download items)
|
||||
file_urls: list[str] = []
|
||||
for line in extra.split("\n"):
|
||||
if line.startswith("Files: "):
|
||||
file_urls = [u.strip() for u in line[7:].split(";") if u.strip()]
|
||||
break
|
||||
if hasattr(item, "file_urls"):
|
||||
file_urls = item.file_urls
|
||||
else:
|
||||
ej = json.loads(item.to_row().get("extra_json", "{}"))
|
||||
file_urls = ej.get("file_urls", [])
|
||||
|
||||
if not file_urls:
|
||||
return {"files": [], "extracted": [], "attachments": []}
|
||||
@@ -255,13 +240,13 @@ def ingest(
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Attach files to Zotero
|
||||
# Attach files to store
|
||||
attachment_keys: list[str] = []
|
||||
if attach:
|
||||
for f in all_files:
|
||||
key = attach_file(zot, item_key, f)
|
||||
if key:
|
||||
attachment_keys.append(key)
|
||||
att_key = store.attach_file(item_key, f)
|
||||
if att_key:
|
||||
attachment_keys.append(att_key)
|
||||
|
||||
# Add summary note
|
||||
if extracted:
|
||||
@@ -273,9 +258,12 @@ def ingest(
|
||||
)
|
||||
for e in extracted:
|
||||
shape = e["dataframe"].shape
|
||||
note += f"<li>{e['file']}: {shape[0]:,} rows × {shape[1]} columns</li>"
|
||||
note += (
|
||||
f"<li>{e['file']}: {shape[0]:,} rows "
|
||||
f"× {shape[1]} columns</li>"
|
||||
)
|
||||
note += "</ul>"
|
||||
attach_note(zot, item_key, note)
|
||||
store.attach_note(item_key, note)
|
||||
|
||||
return {
|
||||
"files": all_files,
|
||||
|
||||
456
src/bib/item.py
456
src/bib/item.py
@@ -1,35 +1,41 @@
|
||||
"""Pydantic models for Zotero item types used in CMS documentation.
|
||||
"""Pydantic models for bibliography item types.
|
||||
|
||||
Each model maps to a Zotero ``itemType`` and provides:
|
||||
Each model maps to a ``bib`` item type and provides:
|
||||
|
||||
- Validated fields matching the Zotero JSON schema
|
||||
- ``to_zotero()`` → dict ready for ``pyzotero.create_items()``
|
||||
- ``from_zotero(data)`` → model from API response
|
||||
- Validated fields for the item's metadata
|
||||
- ``to_row()`` → dict ready for SQLite insertion
|
||||
- ``from_row(row)`` → model from database row
|
||||
|
||||
Zotero item types used:
|
||||
Item types:
|
||||
|
||||
- ``statute`` → ``Rule`` (Federal Register final/proposed rules)
|
||||
- ``report`` → ``Manual`` (CMS Internet-Only Manuals)
|
||||
- ``statute`` → ``Regulation`` (eCFR/CFR regulatory text)
|
||||
- ``webpage`` → ``Download`` (CMS download pages with data files)
|
||||
- ``document`` → ``Source`` (generic source document)
|
||||
- ``rule`` → ``Rule`` (Federal Register final/proposed rules)
|
||||
- ``manual`` → ``Manual`` (CMS Internet-Only Manuals)
|
||||
- ``regulation`` → ``Regulation`` (eCFR/CFR regulatory text)
|
||||
- ``download`` → ``Download`` (CMS download pages with data files)
|
||||
- ``source`` → ``Source`` (generic source document)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import warnings
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class _ZoteroItem(BaseModel):
|
||||
"""Base for all Zotero-backed citation models."""
|
||||
class Item(BaseModel):
|
||||
"""Base for all bibliography item models."""
|
||||
|
||||
key: str = ""
|
||||
"""Zotero item key (8-char). Empty for new items."""
|
||||
"""Item key (8-char alphanumeric). Empty for new items."""
|
||||
|
||||
version: int = 0
|
||||
"""Zotero version number for optimistic concurrency."""
|
||||
item_type: str = ""
|
||||
"""Item type identifier (rule, manual, regulation, download, source)."""
|
||||
|
||||
title: str = ""
|
||||
"""Item title."""
|
||||
|
||||
url: str = ""
|
||||
"""Source URL."""
|
||||
@@ -40,16 +46,102 @@ class _ZoteroItem(BaseModel):
|
||||
abstract: str = ""
|
||||
"""Abstract or summary note."""
|
||||
|
||||
tags: list[dict[str, str | int]] = Field(default_factory=list)
|
||||
"""Zotero tag dicts: ``[{'tag': 'name', 'type': 0}]``."""
|
||||
extra: str = ""
|
||||
"""Free-text extra field for additional data."""
|
||||
|
||||
date_published: str = ""
|
||||
"""Publication date (ISO format)."""
|
||||
|
||||
institution: str = ""
|
||||
"""Issuing institution."""
|
||||
|
||||
tags: list[str] = Field(default_factory=list)
|
||||
"""Tag labels: ``['module:pfs', 'year:2026']``."""
|
||||
|
||||
collections: list[str] = Field(default_factory=list)
|
||||
"""Zotero collection keys this item belongs to."""
|
||||
"""Collection keys this item belongs to."""
|
||||
|
||||
extra: str = ""
|
||||
"""Zotero 'extra' field for additional structured data."""
|
||||
def add_tag(self, tag: str, tag_type: int = 0) -> None:
|
||||
"""Add a tag if not already present.
|
||||
|
||||
The ``tag_type`` parameter is accepted for backward
|
||||
compatibility but ignored (all tags are plain strings).
|
||||
"""
|
||||
if tag not in self.tags:
|
||||
self.tags.append(tag)
|
||||
|
||||
def stamp_access(self) -> None:
|
||||
"""Set access_date to now (ISO format)."""
|
||||
self.access_date = datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
def to_row(self) -> dict[str, Any]:
|
||||
"""Serialize to a dict suitable for SQLite insertion.
|
||||
|
||||
Common fields become columns; subclass-specific fields
|
||||
are packed into ``extra_json``.
|
||||
"""
|
||||
return {
|
||||
"key": self.key,
|
||||
"item_type": self.item_type,
|
||||
"title": self.title,
|
||||
"url": self.url,
|
||||
"date_published": self.date_published,
|
||||
"access_date": self.access_date,
|
||||
"abstract": self.abstract,
|
||||
"institution": self.institution,
|
||||
"extra": self.extra,
|
||||
"extra_json": "{}",
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def from_row(cls, row: dict[str, Any]) -> Item:
|
||||
"""Reconstruct an Item (or subclass) from a database row.
|
||||
|
||||
Uses ``item_type`` to dispatch to the correct subclass
|
||||
via ``_TYPE_MAP``.
|
||||
"""
|
||||
it = row.get("item_type", "")
|
||||
target = _TYPE_MAP.get(it, cls)
|
||||
ej = row.get("extra_json", "{}")
|
||||
extra_data = json.loads(ej) if isinstance(ej, str) else ej
|
||||
|
||||
base = {
|
||||
"key": row.get("key", ""),
|
||||
"item_type": it,
|
||||
"title": row.get("title", ""),
|
||||
"url": row.get("url", ""),
|
||||
"date_published": row.get("date_published", ""),
|
||||
"access_date": row.get("access_date", ""),
|
||||
"abstract": row.get("abstract", ""),
|
||||
"institution": row.get("institution", ""),
|
||||
"extra": row.get("extra", ""),
|
||||
}
|
||||
|
||||
# Merge extra_json fields for subclass construction
|
||||
base.update(extra_data)
|
||||
|
||||
# Handle tags: list[str] or semicolon-separated string
|
||||
tags_raw = row.get("tags")
|
||||
if isinstance(tags_raw, list):
|
||||
base["tags"] = tags_raw
|
||||
elif isinstance(tags_raw, str) and tags_raw:
|
||||
base["tags"] = [t.strip() for t in tags_raw.split(";")]
|
||||
|
||||
# Handle collections: list[str]
|
||||
cols_raw = row.get("collections")
|
||||
if isinstance(cols_raw, list):
|
||||
base["collections"] = cols_raw
|
||||
|
||||
return target(**base)
|
||||
|
||||
# ── Deprecated Zotero helpers ──────────────────────────────
|
||||
|
||||
def _base_dict(self) -> dict:
|
||||
warnings.warn(
|
||||
"_base_dict() is deprecated, use to_row()",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
d: dict = {}
|
||||
if self.url:
|
||||
d["url"] = self.url
|
||||
@@ -58,7 +150,7 @@ class _ZoteroItem(BaseModel):
|
||||
if self.abstract:
|
||||
d["abstractNote"] = self.abstract
|
||||
if self.tags:
|
||||
d["tags"] = self.tags
|
||||
d["tags"] = [{"tag": t, "type": 0} for t in self.tags]
|
||||
if self.collections:
|
||||
d["collections"] = self.collections
|
||||
if self.extra:
|
||||
@@ -69,26 +161,14 @@ class _ZoteroItem(BaseModel):
|
||||
def _get(cls, data: dict, key: str, default: str = "") -> str:
|
||||
return data.get(key, default) or default
|
||||
|
||||
def add_tag(self, tag: str, tag_type: int = 0) -> None:
|
||||
"""Add a tag if not already present."""
|
||||
if not any(t["tag"] == tag for t in self.tags):
|
||||
self.tags.append({"tag": tag, "type": tag_type})
|
||||
|
||||
def stamp_access(self) -> None:
|
||||
"""Set access_date to now (ISO format)."""
|
||||
self.access_date = datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
|
||||
class Rule(_ZoteroItem):
|
||||
class Rule(Item):
|
||||
"""Federal Register rule (final rule, proposed rule, correction).
|
||||
|
||||
Maps to Zotero ``statute`` item type. The ``nameOfAct`` field
|
||||
holds the rule title; ``code``/``codeNumber`` hold the FR
|
||||
citation (e.g. ``89 FR 98452``).
|
||||
Maps to item_type ``rule``.
|
||||
"""
|
||||
|
||||
title: str = ""
|
||||
"""Rule title (maps to Zotero ``nameOfAct``)."""
|
||||
item_type: str = "rule"
|
||||
|
||||
fr_volume: str = ""
|
||||
"""Federal Register volume number."""
|
||||
@@ -105,30 +185,56 @@ class Rule(_ZoteroItem):
|
||||
rule_type: str = ""
|
||||
"""``final``, ``proposed``, ``correction``, ``interim``."""
|
||||
|
||||
date_published: str = ""
|
||||
"""Publication date (ISO format)."""
|
||||
|
||||
effective_date: str = ""
|
||||
"""Effective date of the rule."""
|
||||
|
||||
def to_row(self) -> dict[str, Any]:
|
||||
d = super().to_row()
|
||||
d["extra_json"] = json.dumps({
|
||||
"fr_volume": self.fr_volume,
|
||||
"fr_page": self.fr_page,
|
||||
"document_number": self.document_number,
|
||||
"cms_id": self.cms_id,
|
||||
"rule_type": self.rule_type,
|
||||
"effective_date": self.effective_date,
|
||||
})
|
||||
return d
|
||||
|
||||
def to_zotero(self) -> dict:
|
||||
d = self._base_dict()
|
||||
d["itemType"] = "statute"
|
||||
d["nameOfAct"] = self.title
|
||||
d["code"] = "FR"
|
||||
d["codeNumber"] = self.fr_volume
|
||||
d["pages"] = self.fr_page
|
||||
d["dateEnacted"] = self.date_published
|
||||
d["session"] = self.cms_id
|
||||
d["history"] = (
|
||||
f"Document: {self.document_number}; "
|
||||
f"Type: {self.rule_type}; "
|
||||
f"Effective: {self.effective_date}"
|
||||
warnings.warn(
|
||||
"to_zotero() is deprecated, use to_row()",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
d = {
|
||||
"itemType": "statute",
|
||||
"nameOfAct": self.title,
|
||||
"code": "FR",
|
||||
"codeNumber": self.fr_volume,
|
||||
"pages": self.fr_page,
|
||||
"dateEnacted": self.date_published,
|
||||
"session": self.cms_id,
|
||||
"history": (
|
||||
f"Document: {self.document_number}; "
|
||||
f"Type: {self.rule_type}; "
|
||||
f"Effective: {self.effective_date}"
|
||||
),
|
||||
}
|
||||
if self.url:
|
||||
d["url"] = self.url
|
||||
if self.abstract:
|
||||
d["abstractNote"] = self.abstract
|
||||
if self.extra:
|
||||
d["extra"] = self.extra
|
||||
return d
|
||||
|
||||
@classmethod
|
||||
def from_zotero(cls, data: dict) -> Rule:
|
||||
warnings.warn(
|
||||
"from_zotero() is deprecated, use from_row()",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
d = data.get("data", data)
|
||||
history = cls._get(d, "history")
|
||||
doc_num = ""
|
||||
@@ -141,9 +247,10 @@ class Rule(_ZoteroItem):
|
||||
rule_type = part[6:]
|
||||
elif part.startswith("Effective: "):
|
||||
eff_date = part[11:]
|
||||
tags_raw = d.get("tags", [])
|
||||
tags = [t["tag"] for t in tags_raw if "tag" in t]
|
||||
return cls(
|
||||
key=cls._get(d, "key"),
|
||||
version=d.get("version", 0),
|
||||
title=cls._get(d, "nameOfAct"),
|
||||
fr_volume=cls._get(d, "codeNumber"),
|
||||
fr_page=cls._get(d, "pages"),
|
||||
@@ -155,22 +262,19 @@ class Rule(_ZoteroItem):
|
||||
url=cls._get(d, "url"),
|
||||
access_date=cls._get(d, "accessDate"),
|
||||
abstract=cls._get(d, "abstractNote"),
|
||||
tags=d.get("tags", []),
|
||||
tags=tags,
|
||||
collections=d.get("collections", []),
|
||||
extra=cls._get(d, "extra"),
|
||||
)
|
||||
|
||||
|
||||
class Manual(_ZoteroItem):
|
||||
class Manual(Item):
|
||||
"""CMS Internet-Only Manual (IOM) chapter or transmittal.
|
||||
|
||||
Maps to Zotero ``report`` item type. Covers the Claims
|
||||
Processing Manual, Benefit Policy Manual, Program Integrity
|
||||
Manual, etc.
|
||||
Maps to item_type ``manual``.
|
||||
"""
|
||||
|
||||
title: str = ""
|
||||
"""Chapter or transmittal title."""
|
||||
item_type: str = "manual"
|
||||
|
||||
manual_name: str = ""
|
||||
"""Manual name (e.g. ``Claims Processing Manual``)."""
|
||||
@@ -184,28 +288,50 @@ class Manual(_ZoteroItem):
|
||||
transmittal: str = ""
|
||||
"""Transmittal number (for updates)."""
|
||||
|
||||
date_published: str = ""
|
||||
"""Publication or revision date."""
|
||||
|
||||
institution: str = "Centers for Medicare & Medicaid Services"
|
||||
|
||||
def to_row(self) -> dict[str, Any]:
|
||||
d = super().to_row()
|
||||
d["extra_json"] = json.dumps({
|
||||
"manual_name": self.manual_name,
|
||||
"pub_number": self.pub_number,
|
||||
"chapter": self.chapter,
|
||||
"transmittal": self.transmittal,
|
||||
})
|
||||
return d
|
||||
|
||||
def to_zotero(self) -> dict:
|
||||
d = self._base_dict()
|
||||
d["itemType"] = "report"
|
||||
d["title"] = self.title
|
||||
d["reportType"] = "Internet-Only Manual"
|
||||
d["reportNumber"] = self.pub_number
|
||||
d["seriesTitle"] = self.manual_name
|
||||
d["seriesNumber"] = f"Chapter {self.chapter}"
|
||||
d["institution"] = self.institution
|
||||
d["date"] = self.date_published
|
||||
d["place"] = "Baltimore, MD"
|
||||
warnings.warn(
|
||||
"to_zotero() is deprecated, use to_row()",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
d: dict = {
|
||||
"itemType": "report",
|
||||
"title": self.title,
|
||||
"reportType": "Internet-Only Manual",
|
||||
"reportNumber": self.pub_number,
|
||||
"seriesTitle": self.manual_name,
|
||||
"seriesNumber": f"Chapter {self.chapter}",
|
||||
"institution": self.institution,
|
||||
"date": self.date_published,
|
||||
"place": "Baltimore, MD",
|
||||
}
|
||||
if self.url:
|
||||
d["url"] = self.url
|
||||
if self.transmittal:
|
||||
d["extra"] = (f"Transmittal: {self.transmittal}\n{self.extra}").strip()
|
||||
d["extra"] = (
|
||||
f"Transmittal: {self.transmittal}\n{self.extra}"
|
||||
).strip()
|
||||
return d
|
||||
|
||||
@classmethod
|
||||
def from_zotero(cls, data: dict) -> Manual:
|
||||
warnings.warn(
|
||||
"from_zotero() is deprecated, use from_row()",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
d = data.get("data", data)
|
||||
chapter = cls._get(d, "seriesNumber")
|
||||
if chapter.startswith("Chapter "):
|
||||
@@ -218,9 +344,10 @@ class Manual(_ZoteroItem):
|
||||
transmittal = line[13:]
|
||||
else:
|
||||
extra_lines.append(line)
|
||||
tags_raw = d.get("tags", [])
|
||||
tags = [t["tag"] for t in tags_raw if "tag" in t]
|
||||
return cls(
|
||||
key=cls._get(d, "key"),
|
||||
version=d.get("version", 0),
|
||||
title=cls._get(d, "title"),
|
||||
manual_name=cls._get(d, "seriesTitle"),
|
||||
pub_number=cls._get(d, "reportNumber"),
|
||||
@@ -231,21 +358,19 @@ class Manual(_ZoteroItem):
|
||||
url=cls._get(d, "url"),
|
||||
access_date=cls._get(d, "accessDate"),
|
||||
abstract=cls._get(d, "abstractNote"),
|
||||
tags=d.get("tags", []),
|
||||
tags=tags,
|
||||
collections=d.get("collections", []),
|
||||
extra="\n".join(extra_lines).strip(),
|
||||
)
|
||||
|
||||
|
||||
class Regulation(_ZoteroItem):
|
||||
class Regulation(Item):
|
||||
"""eCFR / Code of Federal Regulations regulatory text.
|
||||
|
||||
Maps to Zotero ``statute`` item type. Covers Title 42
|
||||
(Public Health) and Title 45 (HHS) regulations.
|
||||
Maps to item_type ``regulation``.
|
||||
"""
|
||||
|
||||
title: str = ""
|
||||
"""Regulation section title."""
|
||||
item_type: str = "regulation"
|
||||
|
||||
cfr_title: str = ""
|
||||
"""CFR title number (e.g. ``42``)."""
|
||||
@@ -262,19 +387,45 @@ class Regulation(_ZoteroItem):
|
||||
effective_date: str = ""
|
||||
"""Date of last amendment."""
|
||||
|
||||
def to_row(self) -> dict[str, Any]:
|
||||
d = super().to_row()
|
||||
d["extra_json"] = json.dumps({
|
||||
"cfr_title": self.cfr_title,
|
||||
"cfr_part": self.cfr_part,
|
||||
"cfr_section": self.cfr_section,
|
||||
"authority": self.authority,
|
||||
"effective_date": self.effective_date,
|
||||
})
|
||||
return d
|
||||
|
||||
def to_zotero(self) -> dict:
|
||||
d = self._base_dict()
|
||||
d["itemType"] = "statute"
|
||||
d["nameOfAct"] = self.title
|
||||
d["code"] = "C.F.R."
|
||||
d["codeNumber"] = self.cfr_title
|
||||
d["section"] = self.cfr_section
|
||||
d["dateEnacted"] = self.effective_date
|
||||
d["history"] = f"Part {self.cfr_part}; Authority: {self.authority}"
|
||||
warnings.warn(
|
||||
"to_zotero() is deprecated, use to_row()",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
d: dict = {
|
||||
"itemType": "statute",
|
||||
"nameOfAct": self.title,
|
||||
"code": "C.F.R.",
|
||||
"codeNumber": self.cfr_title,
|
||||
"section": self.cfr_section,
|
||||
"dateEnacted": self.effective_date,
|
||||
"history": (
|
||||
f"Part {self.cfr_part}; Authority: {self.authority}"
|
||||
),
|
||||
}
|
||||
if self.url:
|
||||
d["url"] = self.url
|
||||
return d
|
||||
|
||||
@classmethod
|
||||
def from_zotero(cls, data: dict) -> Regulation:
|
||||
warnings.warn(
|
||||
"from_zotero() is deprecated, use from_row()",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
d = data.get("data", data)
|
||||
history = cls._get(d, "history")
|
||||
part = ""
|
||||
@@ -284,9 +435,10 @@ class Regulation(_ZoteroItem):
|
||||
part = segment[5:]
|
||||
elif segment.startswith("Authority: "):
|
||||
authority = segment[11:]
|
||||
tags_raw = d.get("tags", [])
|
||||
tags = [t["tag"] for t in tags_raw if "tag" in t]
|
||||
return cls(
|
||||
key=cls._get(d, "key"),
|
||||
version=d.get("version", 0),
|
||||
title=cls._get(d, "nameOfAct"),
|
||||
cfr_title=cls._get(d, "codeNumber"),
|
||||
cfr_section=cls._get(d, "section"),
|
||||
@@ -296,22 +448,19 @@ class Regulation(_ZoteroItem):
|
||||
url=cls._get(d, "url"),
|
||||
access_date=cls._get(d, "accessDate"),
|
||||
abstract=cls._get(d, "abstractNote"),
|
||||
tags=d.get("tags", []),
|
||||
tags=tags,
|
||||
collections=d.get("collections", []),
|
||||
extra=cls._get(d, "extra"),
|
||||
)
|
||||
|
||||
|
||||
class Download(_ZoteroItem):
|
||||
class Download(Item):
|
||||
"""CMS download page with associated data files.
|
||||
|
||||
Maps to Zotero ``webpage`` item type. Represents a CMS page
|
||||
that hosts downloadable data files (RVU ZIPs, PE input Excel
|
||||
files, carrier payment CSVs, etc.).
|
||||
Maps to item_type ``download``.
|
||||
"""
|
||||
|
||||
title: str = ""
|
||||
"""Page title."""
|
||||
item_type: str = "download"
|
||||
|
||||
website_title: str = "Centers for Medicare & Medicaid Services"
|
||||
"""Website name."""
|
||||
@@ -322,40 +471,66 @@ class Download(_ZoteroItem):
|
||||
file_urls: list[str] = Field(default_factory=list)
|
||||
"""URLs of downloadable data files on this page."""
|
||||
|
||||
date_published: str = ""
|
||||
"""Publication or last-updated date."""
|
||||
|
||||
year: int | None = None
|
||||
"""Calendar year this data applies to."""
|
||||
|
||||
quarter: str = ""
|
||||
"""Release quarter if applicable (A, B, C, D)."""
|
||||
|
||||
def to_row(self) -> dict[str, Any]:
|
||||
d = super().to_row()
|
||||
d["extra_json"] = json.dumps({
|
||||
"page_type": self.page_type,
|
||||
"file_urls": self.file_urls,
|
||||
"year": self.year,
|
||||
"quarter": self.quarter,
|
||||
"website_title": self.website_title,
|
||||
})
|
||||
return d
|
||||
|
||||
def to_zotero(self) -> dict:
|
||||
d = self._base_dict()
|
||||
d["itemType"] = "webpage"
|
||||
d["title"] = self.title
|
||||
d["websiteTitle"] = self.website_title
|
||||
d["websiteType"] = "Government Data Portal"
|
||||
d["date"] = self.date_published
|
||||
warnings.warn(
|
||||
"to_zotero() is deprecated, use to_row()",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
d: dict = {
|
||||
"itemType": "webpage",
|
||||
"title": self.title,
|
||||
"websiteTitle": self.website_title,
|
||||
"websiteType": "Government Data Portal",
|
||||
"date": self.date_published,
|
||||
}
|
||||
if self.url:
|
||||
d["url"] = self.url
|
||||
if self.file_urls:
|
||||
d["extra"] = (f"Files: {'; '.join(self.file_urls)}\n{self.extra}").strip()
|
||||
d["extra"] = (
|
||||
f"Files: {'; '.join(self.file_urls)}\n{self.extra}"
|
||||
).strip()
|
||||
return d
|
||||
|
||||
@classmethod
|
||||
def from_zotero(cls, data: dict) -> Download:
|
||||
warnings.warn(
|
||||
"from_zotero() is deprecated, use from_row()",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
d = data.get("data", data)
|
||||
extra = cls._get(d, "extra")
|
||||
file_urls: list[str] = []
|
||||
extra_lines = []
|
||||
for line in extra.split("\n"):
|
||||
if line.startswith("Files: "):
|
||||
file_urls = [u.strip() for u in line[7:].split(";") if u.strip()]
|
||||
file_urls = [
|
||||
u.strip() for u in line[7:].split(";") if u.strip()
|
||||
]
|
||||
else:
|
||||
extra_lines.append(line)
|
||||
tags_raw = d.get("tags", [])
|
||||
tags = [t["tag"] for t in tags_raw if "tag" in t]
|
||||
return cls(
|
||||
key=cls._get(d, "key"),
|
||||
version=d.get("version", 0),
|
||||
title=cls._get(d, "title"),
|
||||
website_title=cls._get(d, "websiteTitle"),
|
||||
date_published=cls._get(d, "date"),
|
||||
@@ -363,45 +538,59 @@ class Download(_ZoteroItem):
|
||||
url=cls._get(d, "url"),
|
||||
access_date=cls._get(d, "accessDate"),
|
||||
abstract=cls._get(d, "abstractNote"),
|
||||
tags=d.get("tags", []),
|
||||
tags=tags,
|
||||
collections=d.get("collections", []),
|
||||
extra="\n".join(extra_lines).strip(),
|
||||
)
|
||||
|
||||
|
||||
class Source(_ZoteroItem):
|
||||
class Source(Item):
|
||||
"""Generic source document (fallback for unstructured citations).
|
||||
|
||||
Maps to Zotero ``document`` item type.
|
||||
Maps to item_type ``source``.
|
||||
"""
|
||||
|
||||
title: str = ""
|
||||
"""Document title."""
|
||||
item_type: str = "source"
|
||||
|
||||
doc_type: str = ""
|
||||
"""Document type descriptor."""
|
||||
|
||||
institution: str = ""
|
||||
"""Issuing institution."""
|
||||
|
||||
date_published: str = ""
|
||||
"""Publication date."""
|
||||
def to_row(self) -> dict[str, Any]:
|
||||
d = super().to_row()
|
||||
d["extra_json"] = json.dumps({
|
||||
"doc_type": self.doc_type,
|
||||
})
|
||||
return d
|
||||
|
||||
def to_zotero(self) -> dict:
|
||||
d = self._base_dict()
|
||||
d["itemType"] = "document"
|
||||
d["title"] = self.title
|
||||
d["type"] = self.doc_type
|
||||
d["publisher"] = self.institution
|
||||
d["date"] = self.date_published
|
||||
warnings.warn(
|
||||
"to_zotero() is deprecated, use to_row()",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
d: dict = {
|
||||
"itemType": "document",
|
||||
"title": self.title,
|
||||
"type": self.doc_type,
|
||||
"publisher": self.institution,
|
||||
"date": self.date_published,
|
||||
}
|
||||
if self.url:
|
||||
d["url"] = self.url
|
||||
return d
|
||||
|
||||
@classmethod
|
||||
def from_zotero(cls, data: dict) -> Source:
|
||||
warnings.warn(
|
||||
"from_zotero() is deprecated, use from_row()",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
d = data.get("data", data)
|
||||
tags_raw = d.get("tags", [])
|
||||
tags = [t["tag"] for t in tags_raw if "tag" in t]
|
||||
return cls(
|
||||
key=cls._get(d, "key"),
|
||||
version=d.get("version", 0),
|
||||
title=cls._get(d, "title"),
|
||||
doc_type=cls._get(d, "type"),
|
||||
institution=cls._get(d, "publisher"),
|
||||
@@ -409,7 +598,20 @@ class Source(_ZoteroItem):
|
||||
url=cls._get(d, "url"),
|
||||
access_date=cls._get(d, "accessDate"),
|
||||
abstract=cls._get(d, "abstractNote"),
|
||||
tags=d.get("tags", []),
|
||||
tags=tags,
|
||||
collections=d.get("collections", []),
|
||||
extra=cls._get(d, "extra"),
|
||||
)
|
||||
|
||||
|
||||
# Backward compat alias
|
||||
_ZoteroItem = Item
|
||||
|
||||
# Type dispatch registry for from_row()
|
||||
_TYPE_MAP: dict[str, type[Item]] = {
|
||||
"rule": Rule,
|
||||
"manual": Manual,
|
||||
"regulation": Regulation,
|
||||
"download": Download,
|
||||
"source": Source,
|
||||
}
|
||||
|
||||
79
src/bib/schema.sql
Normal file
79
src/bib/schema.sql
Normal file
@@ -0,0 +1,79 @@
|
||||
-- bib: denormalized bibliography storage
|
||||
-- 8 tables replacing Zotero's 61-table EAV schema.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS bib_meta (
|
||||
key TEXT PRIMARY KEY,
|
||||
value TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS items (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
key TEXT NOT NULL UNIQUE,
|
||||
item_type TEXT NOT NULL,
|
||||
title TEXT NOT NULL DEFAULT '',
|
||||
url TEXT NOT NULL DEFAULT '',
|
||||
date_published TEXT NOT NULL DEFAULT '',
|
||||
access_date TEXT NOT NULL DEFAULT '',
|
||||
abstract TEXT NOT NULL DEFAULT '',
|
||||
institution TEXT NOT NULL DEFAULT '',
|
||||
extra TEXT NOT NULL DEFAULT '',
|
||||
extra_json TEXT NOT NULL DEFAULT '{}',
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ','now')),
|
||||
updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ','now'))
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS collections (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
key TEXT NOT NULL UNIQUE,
|
||||
name TEXT NOT NULL,
|
||||
parent_id INTEGER REFERENCES collections(id) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS collection_items (
|
||||
collection_id INTEGER NOT NULL REFERENCES collections(id) ON DELETE CASCADE,
|
||||
item_id INTEGER NOT NULL REFERENCES items(id) ON DELETE CASCADE,
|
||||
PRIMARY KEY (collection_id, item_id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS tags (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL UNIQUE
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS item_tags (
|
||||
item_id INTEGER NOT NULL REFERENCES items(id) ON DELETE CASCADE,
|
||||
tag_id INTEGER NOT NULL REFERENCES tags(id) ON DELETE CASCADE,
|
||||
PRIMARY KEY (item_id, tag_id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS creators (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
first_name TEXT NOT NULL DEFAULT '',
|
||||
last_name TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS item_creators (
|
||||
item_id INTEGER NOT NULL REFERENCES items(id) ON DELETE CASCADE,
|
||||
creator_id INTEGER NOT NULL REFERENCES creators(id) ON DELETE CASCADE,
|
||||
role TEXT NOT NULL DEFAULT 'author',
|
||||
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (item_id, creator_id, role)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS attachments (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
item_id INTEGER NOT NULL REFERENCES items(id) ON DELETE CASCADE,
|
||||
key TEXT NOT NULL UNIQUE,
|
||||
filename TEXT NOT NULL,
|
||||
content_type TEXT NOT NULL DEFAULT '',
|
||||
storage_path TEXT NOT NULL DEFAULT '',
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ','now'))
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS notes (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
item_id INTEGER NOT NULL REFERENCES items(id) ON DELETE CASCADE,
|
||||
title TEXT NOT NULL DEFAULT '',
|
||||
content TEXT NOT NULL DEFAULT '',
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ','now'))
|
||||
);
|
||||
476
src/bib/spider.py
Normal file
476
src/bib/spider.py
Normal file
@@ -0,0 +1,476 @@
|
||||
"""Citation discovery crawler — local-first reference extraction.
|
||||
|
||||
Reads item attachments from local Zotero storage, parses GPO XML
|
||||
(Federal Register rules) and text content for structured and inline
|
||||
references, classifies them through existing translators, and saves
|
||||
them as supplemental items linked back to the parent.
|
||||
|
||||
The spider never fetches remote content for extraction. Translators
|
||||
may hit APIs (e.g. eCFR structure API) to enrich metadata for
|
||||
newly discovered items, but the *source text* always comes from
|
||||
local files.
|
||||
|
||||
Usage::
|
||||
|
||||
from bib.store import Store
|
||||
from bib.spider import crawl, crawl_all
|
||||
|
||||
s = Store("data/bib.sqlite")
|
||||
found = crawl(s, "ABCD1234")
|
||||
# → ['KEY1', 'KEY2', ...]
|
||||
|
||||
results = crawl_all(s, item_type="rule")
|
||||
# → {parent_key: [child_keys], ...}
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
from bib import translate
|
||||
from bib.item import Source
|
||||
from bib.tag import Tag
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from bib.store import Store
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
ZOTERO_STORAGE = Path("zotero/data/storage")
|
||||
|
||||
# ── URL classification ────────────────────────────────────────────
|
||||
|
||||
_URL_PATTERNS: list[tuple[str, str]] = [
|
||||
(r"federalregister\.gov/documents/\d{4}/", "federal_register"),
|
||||
(r"federalregister\.gov/api/v1/documents/", "federal_register"),
|
||||
(r"cms\.gov/.+manuals/downloads/.+\.pdf", "cms_manual"),
|
||||
(r"ecfr\.gov/current/title-\d+", "ecfr"),
|
||||
(r"cms\.gov/.+(?:fee-schedules|physician|medicare)", "cms_website"),
|
||||
]
|
||||
|
||||
|
||||
def classify_url(url: str) -> str | None:
|
||||
"""Match a URL to a translator name."""
|
||||
for pattern, name in _URL_PATTERNS:
|
||||
if re.search(pattern, url):
|
||||
return name
|
||||
return None
|
||||
|
||||
|
||||
# ── Local content reading ─────────────────────────────────────────
|
||||
|
||||
|
||||
def _get_attachments(store: Store, item_key: str) -> list[dict]:
|
||||
"""Get attachment records for an item from the database."""
|
||||
con = store._con()
|
||||
row = con.execute(
|
||||
"SELECT id FROM items WHERE key = ?", (item_key,)
|
||||
).fetchone()
|
||||
if not row:
|
||||
return []
|
||||
rows = con.execute(
|
||||
"SELECT key, filename, content_type FROM attachments "
|
||||
"WHERE item_id = ?",
|
||||
(row["id"],),
|
||||
).fetchall()
|
||||
return [dict(r) for r in rows]
|
||||
|
||||
|
||||
def _read_attachment(att_key: str, filename: str) -> str:
|
||||
"""Read an attachment file from Zotero storage as text."""
|
||||
path = ZOTERO_STORAGE / att_key / filename
|
||||
if not path.exists():
|
||||
return ""
|
||||
try:
|
||||
return path.read_text(encoding="utf-8", errors="replace")
|
||||
except Exception:
|
||||
return ""
|
||||
|
||||
|
||||
# ── GPO XML parsing ──────────────────────────────────────────────
|
||||
|
||||
|
||||
def extract_xml_refs(xml_text: str) -> list[str]:
|
||||
"""Extract reference URLs from a GPO Federal Register XML file.
|
||||
|
||||
Parses structured elements:
|
||||
- ``<CFR>`` tags → eCFR part URLs
|
||||
- ``<SECTNO>`` tags → eCFR section URLs (with CFR title context)
|
||||
- ``<AMDPAR>`` amendment paragraphs → section refs
|
||||
- Inline ``§ nnn.nnn`` patterns → eCFR section URLs
|
||||
- Inline ``nn FR nnnnn`` patterns → FR document search URLs
|
||||
- ``<E>`` tags containing URLs → classified links
|
||||
"""
|
||||
urls: list[str] = []
|
||||
seen: set[str] = set()
|
||||
|
||||
def _add(u: str) -> None:
|
||||
if u and u not in seen:
|
||||
seen.add(u)
|
||||
urls.append(u)
|
||||
|
||||
# Determine the CFR title from the first <CFR> tag
|
||||
cfr_title = "42" # default for CMS rules
|
||||
cfr_match = re.search(r"<CFR>\s*(\d+)\s+CFR", xml_text)
|
||||
if cfr_match:
|
||||
cfr_title = cfr_match.group(1)
|
||||
|
||||
# 1. <CFR> tags: "42 CFR Parts 410, 411, 414"
|
||||
for m in re.finditer(r"<CFR>(.*?)</CFR>", xml_text):
|
||||
cfr_text = m.group(1)
|
||||
# Extract title
|
||||
t_match = re.match(r"(\d+)\s+CFR", cfr_text)
|
||||
title = t_match.group(1) if t_match else cfr_title
|
||||
# Extract parts
|
||||
for part in re.findall(r"(?:Part[s]?\s+)?(\d{3,})", cfr_text):
|
||||
_add(
|
||||
f"https://www.ecfr.gov/current/title-{title}"
|
||||
f"/part-{part}"
|
||||
)
|
||||
|
||||
# 2. <SECTNO> tags: "§ 414.22"
|
||||
for m in re.finditer(r"<SECTNO>\s*§\s*([\d.]+)", xml_text):
|
||||
section = m.group(1).strip()
|
||||
part = section.split(".")[0]
|
||||
_add(
|
||||
f"https://www.ecfr.gov/current/title-{cfr_title}"
|
||||
f"/part-{part}/section-{section}"
|
||||
)
|
||||
|
||||
# 3. <AMDPAR> amendment paragraphs: "Section 410.30 is amended"
|
||||
for m in re.finditer(r"<AMDPAR>(.*?)</AMDPAR>", xml_text, re.DOTALL):
|
||||
text = re.sub(r"<[^>]+>", "", m.group(1))
|
||||
for s in re.findall(r"§\s*([\d]+\.[\d]+)", text):
|
||||
part = s.split(".")[0]
|
||||
_add(
|
||||
f"https://www.ecfr.gov/current/title-{cfr_title}"
|
||||
f"/part-{part}/section-{s}"
|
||||
)
|
||||
|
||||
# 4. Inline § references in all text content
|
||||
for m in re.finditer(r"§\s*([\d]+\.[\d]+)", xml_text):
|
||||
section = m.group(1)
|
||||
part = section.split(".")[0]
|
||||
_add(
|
||||
f"https://www.ecfr.gov/current/title-{cfr_title}"
|
||||
f"/part-{part}/section-{section}"
|
||||
)
|
||||
|
||||
# 5. FR volume/page citations: "74 FR 61738"
|
||||
for m in re.finditer(
|
||||
r"(\d{2,3})\s+FR\s+(\d{4,6})", xml_text
|
||||
):
|
||||
vol, page = m.group(1), m.group(2)
|
||||
_add(
|
||||
"https://www.federalregister.gov/api/v1/documents"
|
||||
f"?conditions[term]={vol}+FR+{page}"
|
||||
)
|
||||
|
||||
# 6. <E> tags with URLs (italicized links in rule text)
|
||||
for m in re.finditer(r"<E[^>]*>(https?://[^<]+)</E>", xml_text):
|
||||
_add(m.group(1).strip())
|
||||
|
||||
# 7. Public law citations: "Pub. L. 117-169" or "Public Law 110-275"
|
||||
for m in re.finditer(
|
||||
r"(?:Pub(?:lic)?\.?\s*L(?:aw)?\.?)\s*(\d{2,3})[–-](\d+)",
|
||||
xml_text,
|
||||
):
|
||||
congress, law = m.group(1), m.group(2)
|
||||
_add(
|
||||
f"https://www.congress.gov/bill/"
|
||||
f"{_ordinal(int(congress))}-congress/"
|
||||
f"public-law-{law}"
|
||||
)
|
||||
|
||||
return urls
|
||||
|
||||
|
||||
def _ordinal(n: int) -> str:
|
||||
"""Convert integer to ordinal string (e.g. 117 → '117th')."""
|
||||
if 11 <= n % 100 <= 13:
|
||||
return f"{n}th"
|
||||
return f"{n}{['th','st','nd','rd'][min(n%10, 3)] if n%10 < 4 else 'th'}"
|
||||
|
||||
|
||||
# ── Plain text reference extraction ──────────────────────────────
|
||||
|
||||
|
||||
def extract_refs(text: str, cfr_title: str = "42") -> list[str]:
|
||||
"""Extract inline CFR/FR citations from plain text.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
text : str
|
||||
Plain text content.
|
||||
cfr_title : str
|
||||
Default CFR title number for bare § references.
|
||||
"""
|
||||
urls: list[str] = []
|
||||
seen: set[str] = set()
|
||||
|
||||
def _add(u: str) -> None:
|
||||
if u and u not in seen:
|
||||
seen.add(u)
|
||||
urls.append(u)
|
||||
|
||||
# CFR: "42 C.F.R. § 414.22" or "42 CFR 414.22"
|
||||
for m in re.finditer(
|
||||
r"(\d{1,2})\s*C\.?F\.?R\.?\s*§?\s*(\d+(?:\.\d+)?)", text
|
||||
):
|
||||
title = m.group(1)
|
||||
section = m.group(2)
|
||||
part = section.split(".")[0]
|
||||
_add(
|
||||
f"https://www.ecfr.gov/current/title-{title}"
|
||||
f"/part-{part}/section-{section}"
|
||||
)
|
||||
|
||||
# Bare § refs (use default title): "§ 414.22"
|
||||
for m in re.finditer(r"§\s*([\d]+\.[\d]+)", text):
|
||||
section = m.group(1)
|
||||
part = section.split(".")[0]
|
||||
_add(
|
||||
f"https://www.ecfr.gov/current/title-{cfr_title}"
|
||||
f"/part-{part}/section-{section}"
|
||||
)
|
||||
|
||||
# FR: "89 FR 98452" or "89 Fed. Reg. 98452"
|
||||
for m in re.finditer(
|
||||
r"(\d{2,3})\s*(?:FR|Fed\.?\s*Reg\.?)\s*(\d{4,6})", text
|
||||
):
|
||||
vol, page = m.group(1), m.group(2)
|
||||
_add(
|
||||
"https://www.federalregister.gov/api/v1/documents"
|
||||
f"?conditions[term]={vol}+FR+{page}"
|
||||
)
|
||||
|
||||
return urls
|
||||
|
||||
|
||||
# ── URL extraction from HTML ─────────────────────────────────────
|
||||
|
||||
|
||||
def extract_urls(html: str) -> list[str]:
|
||||
"""Extract all href URLs from HTML content."""
|
||||
seen: set[str] = set()
|
||||
urls: list[str] = []
|
||||
for m in re.finditer(r'href="(https?://[^"]+)"', html):
|
||||
url = m.group(1)
|
||||
if url not in seen:
|
||||
seen.add(url)
|
||||
urls.append(url)
|
||||
return urls
|
||||
|
||||
|
||||
# ── Supplemental collection ──────────────────────────────────────
|
||||
|
||||
|
||||
def _get_sup_collection(store: Store, parent_item) -> str:
|
||||
"""Find or create a Supplemental collection for the parent."""
|
||||
collections = store.list_collections()
|
||||
parent_col_key = ""
|
||||
if parent_item.collections:
|
||||
parent_col_key = parent_item.collections[0]
|
||||
|
||||
for col in collections:
|
||||
if (
|
||||
col["name"] == "Supplemental"
|
||||
and col["parent_key"] == parent_col_key
|
||||
):
|
||||
return col["key"]
|
||||
|
||||
if parent_col_key:
|
||||
result = store.ensure_collections(
|
||||
{"Supplemental": {}}, parent_key=parent_col_key
|
||||
)
|
||||
else:
|
||||
result = store.ensure_collections({"Supplemental": {}})
|
||||
return result["Supplemental"]
|
||||
|
||||
|
||||
# ── Translate a discovered URL into an item ──────────────────────
|
||||
|
||||
|
||||
def _translate_url(url: str) -> Source | None:
|
||||
"""Run the appropriate translator for a URL.
|
||||
|
||||
Uses a structured translator when the URL matches a known
|
||||
pattern. Returns None for unclassifiable URLs.
|
||||
"""
|
||||
translator = classify_url(url)
|
||||
if translator is None:
|
||||
# Generic source for .gov / .congress.gov links
|
||||
if re.search(r"https?://[^/]*\.gov/", url):
|
||||
return Source(url=url, title=url)
|
||||
return None
|
||||
try:
|
||||
if translator == "federal_register":
|
||||
return translate.federal_register(url)
|
||||
if translator == "ecfr":
|
||||
return translate.ecfr(url)
|
||||
if translator == "cms_manual":
|
||||
return translate.cms_manual(url)
|
||||
if translator == "cms_website":
|
||||
return translate.cms_website(url)
|
||||
except Exception:
|
||||
log.debug("Translator %s failed for %s", translator, url)
|
||||
return None
|
||||
|
||||
|
||||
def _link_existing(store: Store, url: str, parent_key: str) -> None:
|
||||
"""Add a ``sup:{parent_key}`` tag to an existing item by URL."""
|
||||
con = store._con()
|
||||
row = con.execute(
|
||||
"SELECT key FROM items WHERE url = ?", (url,)
|
||||
).fetchone()
|
||||
if row:
|
||||
store.add_tag(row["key"], Tag.sup(parent_key).label)
|
||||
|
||||
|
||||
# ── Main crawl ────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def crawl(
|
||||
store: Store,
|
||||
key: str,
|
||||
*,
|
||||
depth: int = 1,
|
||||
_seen: set[str] | None = None,
|
||||
) -> list[str]:
|
||||
"""Crawl an item's local attachments for references.
|
||||
|
||||
Reads XML/text files from Zotero storage, extracts structured
|
||||
and inline references, classifies each through translators,
|
||||
and upserts them as supplemental items linked to the parent.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
store : Store
|
||||
Bibliography store.
|
||||
key : str
|
||||
Item key to crawl.
|
||||
depth : int
|
||||
Recursion depth (1 = no recursion).
|
||||
_seen : set, optional
|
||||
Already-visited URLs (shared across ``crawl_all``).
|
||||
|
||||
Returns
|
||||
-------
|
||||
list[str]
|
||||
Keys of all newly discovered/updated items.
|
||||
"""
|
||||
if _seen is None:
|
||||
_seen = set()
|
||||
|
||||
item = store.get(key)
|
||||
if item.url and item.url in _seen:
|
||||
return []
|
||||
if item.url:
|
||||
_seen.add(item.url)
|
||||
|
||||
# Read local attachments
|
||||
all_urls: list[str] = []
|
||||
seen_urls: set[str] = set()
|
||||
|
||||
def _add(u: str) -> None:
|
||||
if u and u not in seen_urls and u != item.url:
|
||||
seen_urls.add(u)
|
||||
all_urls.append(u)
|
||||
|
||||
atts = _get_attachments(store, key)
|
||||
for att in atts:
|
||||
content = _read_attachment(att["key"], att["filename"])
|
||||
if not content:
|
||||
continue
|
||||
|
||||
if att["filename"].endswith(".xml"):
|
||||
# GPO Federal Register XML — richest source
|
||||
for u in extract_xml_refs(content):
|
||||
_add(u)
|
||||
elif att["content_type"].startswith("text/"):
|
||||
# Plain text — extract inline refs
|
||||
for u in extract_refs(content):
|
||||
_add(u)
|
||||
|
||||
if not all_urls:
|
||||
return []
|
||||
|
||||
# Prepare tags inherited from parent
|
||||
inherit_tags = []
|
||||
for t in item.tags:
|
||||
if t.startswith("module:") or t.startswith("year:"):
|
||||
inherit_tags.append(Tag.from_label(t))
|
||||
inherit_tags.append(Tag.sup(key))
|
||||
inherit_tags.append(Tag.source("spider"))
|
||||
|
||||
sup_col = _get_sup_collection(store, item)
|
||||
|
||||
discovered: list[str] = []
|
||||
for url in all_urls:
|
||||
if url in _seen:
|
||||
_link_existing(store, url, key)
|
||||
continue
|
||||
_seen.add(url)
|
||||
|
||||
child = _translate_url(url)
|
||||
if child is None:
|
||||
continue
|
||||
|
||||
child_key = store.upsert(
|
||||
child, tags=inherit_tags, collection=sup_col
|
||||
)
|
||||
discovered.append(child_key)
|
||||
log.info(
|
||||
"Discovered: [%s] %s",
|
||||
child.item_type,
|
||||
child.title[:60],
|
||||
)
|
||||
|
||||
# Recurse into newly discovered items
|
||||
if depth > 1 and discovered:
|
||||
for child_key in list(discovered):
|
||||
sub = crawl(
|
||||
store, child_key, depth=depth - 1, _seen=_seen
|
||||
)
|
||||
discovered.extend(sub)
|
||||
|
||||
return discovered
|
||||
|
||||
|
||||
def crawl_all(
|
||||
store: Store,
|
||||
*,
|
||||
tag: str = "",
|
||||
item_type: str = "",
|
||||
depth: int = 1,
|
||||
) -> dict[str, list[str]]:
|
||||
"""Crawl all items matching filters.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
store : Store
|
||||
Bibliography store.
|
||||
tag : str
|
||||
Filter items by tag label.
|
||||
item_type : str
|
||||
Filter items by type.
|
||||
depth : int
|
||||
Recursion depth per item.
|
||||
|
||||
Returns
|
||||
-------
|
||||
dict[str, list[str]]
|
||||
``{parent_key: [child_keys]}``.
|
||||
"""
|
||||
items = store.list_items(tag=tag, item_type=item_type)
|
||||
seen: set[str] = set()
|
||||
results: dict[str, list[str]] = {}
|
||||
|
||||
for item in items:
|
||||
found = crawl(store, item.key, depth=depth, _seen=seen)
|
||||
if found:
|
||||
results[item.key] = found
|
||||
|
||||
return results
|
||||
559
src/bib/store.py
Normal file
559
src/bib/store.py
Normal file
@@ -0,0 +1,559 @@
|
||||
"""Own-storage bibliography backend — replaces Zotero contexts.
|
||||
|
||||
``Store`` owns a SQLite database with the denormalized 8-table schema
|
||||
(``schema.sql``) and provides all CRUD, querying, tagging, attachment,
|
||||
and citation-formatting operations.
|
||||
|
||||
Usage::
|
||||
|
||||
from bib.store import Store
|
||||
from bib.item import Rule
|
||||
|
||||
s = Store("data/bib.sqlite")
|
||||
key = s.create(Rule(title="CY 2026 PFS Final Rule", fr_volume="90"))
|
||||
item = s.get(key)
|
||||
print(s.format_citation(key))
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import mimetypes
|
||||
import random
|
||||
import shutil
|
||||
import sqlite3
|
||||
import string
|
||||
from importlib import resources
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from bib.item import Item
|
||||
|
||||
|
||||
def _generate_key() -> str:
|
||||
"""8-char alphanumeric key."""
|
||||
chars = string.ascii_uppercase + string.digits
|
||||
return "".join(random.choices(chars, k=8)) # noqa: S311
|
||||
|
||||
|
||||
class Store:
|
||||
"""SQLite-backed bibliography store.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
database : str or Path
|
||||
Path to the SQLite file. Use ``":memory:"`` for in-memory.
|
||||
storage_dir : str or Path, optional
|
||||
Directory for file attachments. Defaults to a ``storage/``
|
||||
sibling of the database file.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
database: str | Path = "data/bib.sqlite",
|
||||
*,
|
||||
storage_dir: str | Path = "",
|
||||
) -> None:
|
||||
self._db_path = str(database)
|
||||
self._connection: sqlite3.Connection | None = None
|
||||
|
||||
if storage_dir:
|
||||
self._storage = Path(storage_dir)
|
||||
elif self._db_path == ":memory:":
|
||||
self._storage = Path("storage")
|
||||
else:
|
||||
self._storage = Path(self._db_path).parent / "storage"
|
||||
|
||||
self._init_schema()
|
||||
|
||||
# ── Connection / schema ──────────────────────────────────────
|
||||
|
||||
def _con(self) -> sqlite3.Connection:
|
||||
if self._connection is None:
|
||||
self._connection = sqlite3.connect(self._db_path)
|
||||
self._connection.row_factory = sqlite3.Row
|
||||
self._connection.execute("PRAGMA journal_mode=WAL")
|
||||
self._connection.execute("PRAGMA foreign_keys=ON")
|
||||
return self._connection
|
||||
|
||||
def _init_schema(self) -> None:
|
||||
ddl = (
|
||||
resources.files("bib").joinpath("schema.sql").read_text()
|
||||
)
|
||||
self._con().executescript(ddl)
|
||||
|
||||
def close(self) -> None:
|
||||
if self._connection is not None:
|
||||
self._connection.close()
|
||||
self._connection = None
|
||||
|
||||
def __del__(self) -> None:
|
||||
try:
|
||||
self.close()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# ── Item CRUD ────────────────────────────────────────────────
|
||||
|
||||
def create(
|
||||
self,
|
||||
item: Item,
|
||||
*,
|
||||
tags: list[Any] | None = None,
|
||||
collection: str = "",
|
||||
) -> str:
|
||||
"""Insert a new item. Returns the item key."""
|
||||
if tags:
|
||||
for tag in tags:
|
||||
label = tag.label if hasattr(tag, "label") else str(tag)
|
||||
item.add_tag(label)
|
||||
if collection and collection not in item.collections:
|
||||
item.collections.append(collection)
|
||||
|
||||
item.stamp_access()
|
||||
row = item.to_row()
|
||||
key = row["key"] or _generate_key()
|
||||
row["key"] = key
|
||||
|
||||
con = self._con()
|
||||
con.execute(
|
||||
"""INSERT INTO items
|
||||
(key, item_type, title, url, date_published,
|
||||
access_date, abstract, institution, extra, extra_json)
|
||||
VALUES (:key, :item_type, :title, :url,
|
||||
:date_published, :access_date, :abstract,
|
||||
:institution, :extra, :extra_json)""",
|
||||
row,
|
||||
)
|
||||
item_id = con.execute(
|
||||
"SELECT id FROM items WHERE key = ?", (key,)
|
||||
).fetchone()["id"]
|
||||
|
||||
self._sync_tags(item_id, item.tags)
|
||||
self._sync_collections(item_id, item.collections)
|
||||
con.commit()
|
||||
return key
|
||||
|
||||
def get(self, key: str) -> Item:
|
||||
"""Fetch an item by key."""
|
||||
con = self._con()
|
||||
row = con.execute(
|
||||
"SELECT * FROM items WHERE key = ?", (key,)
|
||||
).fetchone()
|
||||
if row is None:
|
||||
raise KeyError(f"Item not found: {key}")
|
||||
|
||||
d = dict(row)
|
||||
item_id = d.pop("id")
|
||||
d.pop("created_at", None)
|
||||
d.pop("updated_at", None)
|
||||
|
||||
# Load tags
|
||||
tag_rows = con.execute(
|
||||
"""SELECT t.name FROM item_tags it
|
||||
JOIN tags t ON it.tag_id = t.id
|
||||
WHERE it.item_id = ?""",
|
||||
(item_id,),
|
||||
).fetchall()
|
||||
d["tags"] = [r["name"] for r in tag_rows]
|
||||
|
||||
# Load collections
|
||||
col_rows = con.execute(
|
||||
"""SELECT c.key FROM collection_items ci
|
||||
JOIN collections c ON ci.collection_id = c.id
|
||||
WHERE ci.item_id = ?""",
|
||||
(item_id,),
|
||||
).fetchall()
|
||||
d["collections"] = [r["key"] for r in col_rows]
|
||||
|
||||
return Item.from_row(d)
|
||||
|
||||
def update(self, key: str, **fields: Any) -> None:
|
||||
"""Update specific fields on an item."""
|
||||
if not fields:
|
||||
return
|
||||
|
||||
con = self._con()
|
||||
# Separate tag/collection updates from column updates
|
||||
new_tags = fields.pop("tags", None)
|
||||
new_collections = fields.pop("collections", None)
|
||||
|
||||
if fields:
|
||||
sets = ", ".join(f"{k} = ?" for k in fields)
|
||||
vals = list(fields.values()) + [key]
|
||||
con.execute(
|
||||
f"UPDATE items SET {sets}, " # noqa: S608
|
||||
"updated_at = strftime('%Y-%m-%dT%H:%M:%SZ','now') "
|
||||
f"WHERE key = ?",
|
||||
vals,
|
||||
)
|
||||
|
||||
if new_tags is not None or new_collections is not None:
|
||||
row = con.execute(
|
||||
"SELECT id FROM items WHERE key = ?", (key,)
|
||||
).fetchone()
|
||||
if row is None:
|
||||
raise KeyError(f"Item not found: {key}")
|
||||
item_id = row["id"]
|
||||
if new_tags is not None:
|
||||
self._sync_tags(item_id, new_tags)
|
||||
if new_collections is not None:
|
||||
self._sync_collections(item_id, new_collections)
|
||||
|
||||
con.commit()
|
||||
|
||||
def delete(self, key: str) -> None:
|
||||
"""Delete an item and its associations."""
|
||||
con = self._con()
|
||||
con.execute("DELETE FROM items WHERE key = ?", (key,))
|
||||
con.commit()
|
||||
|
||||
def upsert(
|
||||
self,
|
||||
item: Item,
|
||||
*,
|
||||
tags: list[Any] | None = None,
|
||||
collection: str = "",
|
||||
) -> str:
|
||||
"""Create or update an item, deduplicating by URL."""
|
||||
if item.url:
|
||||
con = self._con()
|
||||
existing = con.execute(
|
||||
"SELECT key FROM items WHERE url = ?", (item.url,)
|
||||
).fetchone()
|
||||
if existing:
|
||||
ekey = existing["key"]
|
||||
row = item.to_row()
|
||||
row.pop("key", None)
|
||||
# Merge tags
|
||||
if tags:
|
||||
for tag in tags:
|
||||
label = (
|
||||
tag.label
|
||||
if hasattr(tag, "label")
|
||||
else str(tag)
|
||||
)
|
||||
item.add_tag(label)
|
||||
if collection and collection not in item.collections:
|
||||
item.collections.append(collection)
|
||||
item.stamp_access()
|
||||
row = item.to_row()
|
||||
row.pop("key", None)
|
||||
row["tags"] = item.tags
|
||||
row["collections"] = item.collections
|
||||
self.update(ekey, **row)
|
||||
return ekey
|
||||
|
||||
return self.create(item, tags=tags, collection=collection)
|
||||
|
||||
# ── Query ────────────────────────────────────────────────────
|
||||
|
||||
def list_items(
|
||||
self,
|
||||
*,
|
||||
tag: str = "",
|
||||
item_type: str = "",
|
||||
collection: str = "",
|
||||
query: str = "",
|
||||
) -> list[Item]:
|
||||
"""List items with optional filters."""
|
||||
con = self._con()
|
||||
sql = "SELECT DISTINCT i.key FROM items i"
|
||||
joins: list[str] = []
|
||||
wheres: list[str] = []
|
||||
params: list[Any] = []
|
||||
|
||||
if tag:
|
||||
joins.append(
|
||||
" JOIN item_tags it ON i.id = it.item_id"
|
||||
" JOIN tags t ON it.tag_id = t.id"
|
||||
)
|
||||
wheres.append("t.name = ?")
|
||||
params.append(tag)
|
||||
|
||||
if collection:
|
||||
joins.append(
|
||||
" JOIN collection_items ci ON i.id = ci.item_id"
|
||||
" JOIN collections c ON ci.collection_id = c.id"
|
||||
)
|
||||
wheres.append("c.key = ?")
|
||||
params.append(collection)
|
||||
|
||||
if item_type:
|
||||
wheres.append("i.item_type = ?")
|
||||
params.append(item_type)
|
||||
|
||||
if query:
|
||||
wheres.append("(i.title LIKE ? OR i.abstract LIKE ?)")
|
||||
params.extend([f"%{query}%", f"%{query}%"])
|
||||
|
||||
full_sql = sql + "".join(joins)
|
||||
if wheres:
|
||||
full_sql += " WHERE " + " AND ".join(wheres)
|
||||
full_sql += " ORDER BY i.id"
|
||||
|
||||
rows = con.execute(full_sql, params).fetchall()
|
||||
return [self.get(r["key"]) for r in rows]
|
||||
|
||||
def count(self, **filters: Any) -> int:
|
||||
"""Count items matching filters."""
|
||||
return len(self.list_items(**filters))
|
||||
|
||||
def to_dataframe(self, **filters: Any) -> Any:
|
||||
"""Export items as a polars DataFrame (lazy import)."""
|
||||
import polars as pl
|
||||
|
||||
items = self.list_items(**filters)
|
||||
rows = []
|
||||
for item in items:
|
||||
rows.append({
|
||||
"key": item.key,
|
||||
"item_type": item.item_type,
|
||||
"title": item.title,
|
||||
"url": item.url,
|
||||
"date_published": item.date_published,
|
||||
"tags": "; ".join(item.tags),
|
||||
"institution": item.institution,
|
||||
})
|
||||
|
||||
return pl.DataFrame(rows)
|
||||
|
||||
# ── Collections ──────────────────────────────────────────────
|
||||
|
||||
def list_collections(self) -> list[dict[str, Any]]:
|
||||
"""List all collections."""
|
||||
con = self._con()
|
||||
rows = con.execute(
|
||||
"""SELECT c.key, c.name, pc.key AS parent_key,
|
||||
(SELECT count(*) FROM collection_items ci
|
||||
WHERE ci.collection_id = c.id) AS item_count
|
||||
FROM collections c
|
||||
LEFT JOIN collections pc ON c.parent_id = pc.id
|
||||
ORDER BY c.name"""
|
||||
).fetchall()
|
||||
return [
|
||||
{
|
||||
"key": r["key"],
|
||||
"name": r["name"],
|
||||
"parent_key": r["parent_key"] or "",
|
||||
"item_count": r["item_count"],
|
||||
}
|
||||
for r in rows
|
||||
]
|
||||
|
||||
def ensure_collections(
|
||||
self,
|
||||
hierarchy: dict[str, dict],
|
||||
parent_key: str | None = None,
|
||||
) -> dict[str, str]:
|
||||
"""Create collections from a nested dict. Returns {name: key}."""
|
||||
con = self._con()
|
||||
result: dict[str, str] = {}
|
||||
|
||||
parent_id: int | None = None
|
||||
if parent_key:
|
||||
row = con.execute(
|
||||
"SELECT id FROM collections WHERE key = ?",
|
||||
(parent_key,),
|
||||
).fetchone()
|
||||
if row:
|
||||
parent_id = row["id"]
|
||||
|
||||
for name, children in hierarchy.items():
|
||||
if parent_id is not None:
|
||||
row = con.execute(
|
||||
"SELECT id, key FROM collections "
|
||||
"WHERE name = ? AND parent_id = ?",
|
||||
(name, parent_id),
|
||||
).fetchone()
|
||||
else:
|
||||
row = con.execute(
|
||||
"SELECT id, key FROM collections "
|
||||
"WHERE name = ? AND parent_id IS NULL",
|
||||
(name,),
|
||||
).fetchone()
|
||||
|
||||
if row:
|
||||
key = row["key"]
|
||||
else:
|
||||
key = _generate_key()
|
||||
con.execute(
|
||||
"INSERT INTO collections (key, name, parent_id) "
|
||||
"VALUES (?, ?, ?)",
|
||||
(key, name, parent_id),
|
||||
)
|
||||
|
||||
result[name] = key
|
||||
|
||||
if children:
|
||||
child_map = self.ensure_collections(
|
||||
children, parent_key=key
|
||||
)
|
||||
result.update(child_map)
|
||||
|
||||
con.commit()
|
||||
return result
|
||||
|
||||
# ── Tags ─────────────────────────────────────────────────────
|
||||
|
||||
def _ensure_tag(self, name: str) -> int:
|
||||
con = self._con()
|
||||
row = con.execute(
|
||||
"SELECT id FROM tags WHERE name = ?", (name,)
|
||||
).fetchone()
|
||||
if row:
|
||||
return row["id"]
|
||||
cur = con.execute("INSERT INTO tags (name) VALUES (?)", (name,))
|
||||
return cur.lastrowid # type: ignore[return-value]
|
||||
|
||||
def _sync_tags(self, item_id: int, tag_names: list[str]) -> None:
|
||||
con = self._con()
|
||||
con.execute("DELETE FROM item_tags WHERE item_id = ?", (item_id,))
|
||||
for name in tag_names:
|
||||
if not name:
|
||||
continue
|
||||
tag_id = self._ensure_tag(name)
|
||||
con.execute(
|
||||
"INSERT OR IGNORE INTO item_tags (item_id, tag_id) "
|
||||
"VALUES (?, ?)",
|
||||
(item_id, tag_id),
|
||||
)
|
||||
|
||||
def _sync_collections(
|
||||
self, item_id: int, collection_keys: list[str]
|
||||
) -> None:
|
||||
con = self._con()
|
||||
con.execute(
|
||||
"DELETE FROM collection_items WHERE item_id = ?", (item_id,)
|
||||
)
|
||||
for ckey in collection_keys:
|
||||
row = con.execute(
|
||||
"SELECT id FROM collections WHERE key = ?", (ckey,)
|
||||
).fetchone()
|
||||
if row:
|
||||
con.execute(
|
||||
"INSERT OR IGNORE INTO collection_items "
|
||||
"(collection_id, item_id) VALUES (?, ?)",
|
||||
(row["id"], item_id),
|
||||
)
|
||||
|
||||
def add_tag(self, item_key: str, tag: str) -> None:
|
||||
"""Add a single tag to an item."""
|
||||
con = self._con()
|
||||
row = con.execute(
|
||||
"SELECT id FROM items WHERE key = ?", (item_key,)
|
||||
).fetchone()
|
||||
if row is None:
|
||||
raise KeyError(f"Item not found: {item_key}")
|
||||
tag_id = self._ensure_tag(tag)
|
||||
con.execute(
|
||||
"INSERT OR IGNORE INTO item_tags (item_id, tag_id) "
|
||||
"VALUES (?, ?)",
|
||||
(row["id"], tag_id),
|
||||
)
|
||||
con.commit()
|
||||
|
||||
def remove_tag(self, item_key: str, tag: str) -> None:
|
||||
"""Remove a tag from an item."""
|
||||
con = self._con()
|
||||
con.execute(
|
||||
"""DELETE FROM item_tags
|
||||
WHERE item_id = (SELECT id FROM items WHERE key = ?)
|
||||
AND tag_id = (SELECT id FROM tags WHERE name = ?)""",
|
||||
(item_key, tag),
|
||||
)
|
||||
con.commit()
|
||||
|
||||
def list_tags(self, *, namespace: str = "") -> list[dict[str, int]]:
|
||||
"""List tags with item counts. Filter by namespace prefix."""
|
||||
con = self._con()
|
||||
if namespace:
|
||||
rows = con.execute(
|
||||
"""SELECT t.name, count(*) AS cnt
|
||||
FROM tags t
|
||||
JOIN item_tags it ON t.id = it.tag_id
|
||||
WHERE t.name LIKE ?
|
||||
GROUP BY t.name ORDER BY t.name""",
|
||||
(f"{namespace}:%",),
|
||||
).fetchall()
|
||||
else:
|
||||
rows = con.execute(
|
||||
"""SELECT t.name, count(*) AS cnt
|
||||
FROM tags t
|
||||
JOIN item_tags it ON t.id = it.tag_id
|
||||
GROUP BY t.name ORDER BY t.name"""
|
||||
).fetchall()
|
||||
return [{"name": r["name"], "count": r["cnt"]} for r in rows]
|
||||
|
||||
# ── Attachments & Notes ──────────────────────────────────────
|
||||
|
||||
def attach_file(
|
||||
self, item_key: str, path: Path, *, title: str = ""
|
||||
) -> str:
|
||||
"""Copy a file into storage and link it to an item."""
|
||||
con = self._con()
|
||||
row = con.execute(
|
||||
"SELECT id FROM items WHERE key = ?", (item_key,)
|
||||
).fetchone()
|
||||
if row is None:
|
||||
raise KeyError(f"Item not found: {item_key}")
|
||||
|
||||
att_key = _generate_key()
|
||||
dest_dir = self._storage / att_key
|
||||
dest_dir.mkdir(parents=True, exist_ok=True)
|
||||
dest = dest_dir / path.name
|
||||
shutil.copy2(path, dest)
|
||||
|
||||
content_type = (
|
||||
mimetypes.guess_type(path.name)[0] or "application/octet-stream"
|
||||
)
|
||||
|
||||
con.execute(
|
||||
"""INSERT INTO attachments
|
||||
(item_id, key, filename, content_type, storage_path)
|
||||
VALUES (?, ?, ?, ?, ?)""",
|
||||
(
|
||||
row["id"],
|
||||
att_key,
|
||||
title or path.name,
|
||||
content_type,
|
||||
str(dest),
|
||||
),
|
||||
)
|
||||
con.commit()
|
||||
return att_key
|
||||
|
||||
def attach_note(
|
||||
self, item_key: str, content: str, *, title: str = ""
|
||||
) -> int:
|
||||
"""Add a note to an item. Returns the note ID."""
|
||||
con = self._con()
|
||||
row = con.execute(
|
||||
"SELECT id FROM items WHERE key = ?", (item_key,)
|
||||
).fetchone()
|
||||
if row is None:
|
||||
raise KeyError(f"Item not found: {item_key}")
|
||||
|
||||
cur = con.execute(
|
||||
"INSERT INTO notes (item_id, title, content) VALUES (?, ?, ?)",
|
||||
(row["id"], title, content),
|
||||
)
|
||||
con.commit()
|
||||
return cur.lastrowid # type: ignore[return-value]
|
||||
|
||||
# ── Citation formatting ──────────────────────────────────────
|
||||
|
||||
def format_citation(self, key: str, style: str = "apa") -> str:
|
||||
"""Format a single item as a citation string."""
|
||||
from bib.format import format_citation
|
||||
|
||||
item = self.get(key)
|
||||
return format_citation(item, style=style)
|
||||
|
||||
def format_bibliography(
|
||||
self, keys: list[str], style: str = "apa"
|
||||
) -> str:
|
||||
"""Format multiple items as a bibliography."""
|
||||
from bib.format import format_bibliography
|
||||
|
||||
items = [self.get(k) for k in keys]
|
||||
return format_bibliography(items, style=style)
|
||||
415
src/bib/sync.py
Normal file
415
src/bib/sync.py
Normal file
@@ -0,0 +1,415 @@
|
||||
"""Push bib items into Zotero's SQLite EAV schema.
|
||||
|
||||
Reverse of ``dev/migrate_zotero.py`` — takes items from
|
||||
``data/bib.sqlite`` and inserts them into ``zotero.sqlite``
|
||||
using Zotero's 61-table EAV layout so they appear in the
|
||||
Zotero desktop application.
|
||||
|
||||
Usage::
|
||||
|
||||
from bib.store import Store
|
||||
from bib.sync import push_to_zotero
|
||||
|
||||
s = Store("data/bib.sqlite")
|
||||
items = s.list_items(tag="source:spider")
|
||||
stats = push_to_zotero(items, zotero_db="zotero/data/zotero.sqlite")
|
||||
print(stats)
|
||||
# {'created': 5908, 'skipped': 12, 'tags': 23456, 'collections': 2}
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import random
|
||||
import sqlite3
|
||||
import string
|
||||
from datetime import datetime, timezone
|
||||
from bib.item import Item
|
||||
|
||||
|
||||
# ── Zotero constants ──────────────────────────────────────────────
|
||||
|
||||
_TYPE_MAP = {
|
||||
"rule": 36, # statute
|
||||
"regulation": 36, # statute
|
||||
"manual": 34, # report
|
||||
"download": 40, # webpage
|
||||
"source": 14, # document
|
||||
}
|
||||
|
||||
# fieldName → fieldID (from Zotero's fields table)
|
||||
_FIELD_IDS = {
|
||||
"title": 1,
|
||||
"nameOfAct": 116,
|
||||
"abstractNote": 2,
|
||||
"code": 31,
|
||||
"codeNumber": 117,
|
||||
"dateEnacted": 119,
|
||||
"pages": 35,
|
||||
"section": 33,
|
||||
"session": 38,
|
||||
"history": 39,
|
||||
"url": 10,
|
||||
"accessDate": 11,
|
||||
"extra": 19,
|
||||
"date": 6,
|
||||
"type": 43,
|
||||
"publisher": 25,
|
||||
"institution": 90,
|
||||
"reportNumber": 113,
|
||||
"reportType": 114,
|
||||
"seriesTitle": 21,
|
||||
"seriesNumber": 46,
|
||||
"place": 26,
|
||||
"websiteTitle": 123,
|
||||
"websiteType": 42,
|
||||
}
|
||||
|
||||
|
||||
def _zotero_key() -> str:
|
||||
"""Generate an 8-char Zotero-style key."""
|
||||
chars = string.ascii_uppercase + string.digits
|
||||
return "".join(random.choices(chars, k=8)) # noqa: S311
|
||||
|
||||
|
||||
def _now_iso() -> str:
|
||||
return datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
|
||||
def _ensure_value(con: sqlite3.Connection, value: str) -> int:
|
||||
"""Find or create a row in itemDataValues. Returns valueID."""
|
||||
row = con.execute(
|
||||
"SELECT valueID FROM itemDataValues WHERE value = ?",
|
||||
(value,),
|
||||
).fetchone()
|
||||
if row:
|
||||
return row[0]
|
||||
cur = con.execute(
|
||||
"INSERT INTO itemDataValues (value) VALUES (?)", (value,)
|
||||
)
|
||||
return cur.lastrowid
|
||||
|
||||
|
||||
def _ensure_tag(con: sqlite3.Connection, name: str) -> int:
|
||||
"""Find or create a tag. Returns tagID."""
|
||||
row = con.execute(
|
||||
"SELECT tagID FROM tags WHERE name = ?", (name,)
|
||||
).fetchone()
|
||||
if row:
|
||||
return row[0]
|
||||
cur = con.execute("INSERT INTO tags (name) VALUES (?)", (name,))
|
||||
return cur.lastrowid
|
||||
|
||||
|
||||
def _set_field(
|
||||
con: sqlite3.Connection,
|
||||
item_id: int,
|
||||
field_name: str,
|
||||
value: str,
|
||||
) -> None:
|
||||
"""Set a field on a Zotero item via the EAV tables."""
|
||||
if not value:
|
||||
return
|
||||
field_id = _FIELD_IDS.get(field_name)
|
||||
if field_id is None:
|
||||
return
|
||||
value_id = _ensure_value(con, value)
|
||||
con.execute(
|
||||
"INSERT OR REPLACE INTO itemData (itemID, fieldID, valueID) "
|
||||
"VALUES (?, ?, ?)",
|
||||
(item_id, field_id, value_id),
|
||||
)
|
||||
|
||||
|
||||
def _item_to_zotero_fields(item: Item) -> dict[str, str]:
|
||||
"""Convert a bib Item to Zotero EAV field dict."""
|
||||
ej = json.loads(item.to_row().get("extra_json", "{}"))
|
||||
|
||||
if item.item_type == "rule":
|
||||
history_parts = []
|
||||
if ej.get("document_number"):
|
||||
history_parts.append(f"Document: {ej['document_number']}")
|
||||
if ej.get("rule_type"):
|
||||
history_parts.append(f"Type: {ej['rule_type']}")
|
||||
if ej.get("effective_date"):
|
||||
history_parts.append(f"Effective: {ej['effective_date']}")
|
||||
return {
|
||||
"nameOfAct": item.title,
|
||||
"code": "FR",
|
||||
"codeNumber": ej.get("fr_volume", ""),
|
||||
"pages": ej.get("fr_page", ""),
|
||||
"session": ej.get("cms_id", ""),
|
||||
"dateEnacted": item.date_published,
|
||||
"history": "; ".join(history_parts),
|
||||
"url": item.url,
|
||||
"accessDate": item.access_date,
|
||||
"abstractNote": item.abstract,
|
||||
"extra": item.extra,
|
||||
}
|
||||
|
||||
if item.item_type == "regulation":
|
||||
part = ej.get("cfr_part", "")
|
||||
authority = ej.get("authority", "")
|
||||
history = f"Part {part}"
|
||||
if authority:
|
||||
history += f"; Authority: {authority}"
|
||||
return {
|
||||
"nameOfAct": item.title,
|
||||
"code": "C.F.R.",
|
||||
"codeNumber": ej.get("cfr_title", ""),
|
||||
"section": ej.get("cfr_section", ""),
|
||||
"dateEnacted": ej.get("effective_date", ""),
|
||||
"history": history,
|
||||
"url": item.url,
|
||||
"accessDate": item.access_date,
|
||||
"abstractNote": item.abstract,
|
||||
"extra": item.extra,
|
||||
}
|
||||
|
||||
if item.item_type == "manual":
|
||||
chapter = ej.get("chapter", "")
|
||||
extra = item.extra
|
||||
if ej.get("transmittal"):
|
||||
extra = f"Transmittal: {ej['transmittal']}\n{extra}".strip()
|
||||
return {
|
||||
"title": item.title,
|
||||
"reportType": "Internet-Only Manual",
|
||||
"reportNumber": ej.get("pub_number", ""),
|
||||
"seriesTitle": ej.get("manual_name", ""),
|
||||
"seriesNumber": f"Chapter {chapter}" if chapter else "",
|
||||
"institution": item.institution,
|
||||
"date": item.date_published,
|
||||
"place": "Baltimore, MD",
|
||||
"url": item.url,
|
||||
"accessDate": item.access_date,
|
||||
"abstractNote": item.abstract,
|
||||
"extra": extra,
|
||||
}
|
||||
|
||||
if item.item_type == "download":
|
||||
file_urls = ej.get("file_urls", [])
|
||||
extra = item.extra
|
||||
if file_urls:
|
||||
extra = f"Files: {'; '.join(file_urls)}\n{extra}".strip()
|
||||
return {
|
||||
"title": item.title,
|
||||
"websiteTitle": ej.get(
|
||||
"website_title",
|
||||
"Centers for Medicare & Medicaid Services",
|
||||
),
|
||||
"websiteType": "Government Data Portal",
|
||||
"date": item.date_published,
|
||||
"url": item.url,
|
||||
"accessDate": item.access_date,
|
||||
"abstractNote": item.abstract,
|
||||
"extra": extra,
|
||||
}
|
||||
|
||||
# source (document)
|
||||
return {
|
||||
"title": item.title,
|
||||
"type": ej.get("doc_type", ""),
|
||||
"publisher": item.institution,
|
||||
"date": item.date_published,
|
||||
"url": item.url,
|
||||
"accessDate": item.access_date,
|
||||
"abstractNote": item.abstract,
|
||||
"extra": item.extra,
|
||||
}
|
||||
|
||||
|
||||
# ── Main push function ───────────────────────────────────────────
|
||||
|
||||
|
||||
def push_to_zotero(
|
||||
items: list[Item],
|
||||
*,
|
||||
zotero_db: str = "zotero/data/zotero.sqlite",
|
||||
collection_key: str = "",
|
||||
) -> dict[str, int]:
|
||||
"""Push bib items into Zotero's SQLite database.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
items : list[Item]
|
||||
Items to sync.
|
||||
zotero_db : str
|
||||
Path to Zotero's SQLite database.
|
||||
collection_key : str
|
||||
Optional Zotero collection key to add items to.
|
||||
|
||||
Returns
|
||||
-------
|
||||
dict
|
||||
Counts: created, skipped, tags, collections.
|
||||
"""
|
||||
con = sqlite3.connect(zotero_db)
|
||||
con.row_factory = sqlite3.Row
|
||||
con.execute("PRAGMA journal_mode=WAL")
|
||||
|
||||
stats: dict[str, int] = {
|
||||
"created": 0,
|
||||
"skipped": 0,
|
||||
"tags": 0,
|
||||
"collections": 0,
|
||||
}
|
||||
|
||||
now = _now_iso()
|
||||
|
||||
# Resolve collection
|
||||
collection_id: int | None = None
|
||||
if collection_key:
|
||||
row = con.execute(
|
||||
"SELECT collectionID FROM collections WHERE key = ?",
|
||||
(collection_key,),
|
||||
).fetchone()
|
||||
if row:
|
||||
collection_id = row[0]
|
||||
|
||||
for item in items:
|
||||
# Skip if URL already exists in Zotero
|
||||
if item.url:
|
||||
existing = con.execute(
|
||||
"""SELECT i.itemID FROM items i
|
||||
JOIN itemData id ON i.itemID = id.itemID
|
||||
JOIN itemDataValues idv ON id.valueID = idv.valueID
|
||||
WHERE id.fieldID = ? AND idv.value = ?""",
|
||||
(_FIELD_IDS["url"], item.url),
|
||||
).fetchone()
|
||||
if existing:
|
||||
# Still add tags to existing item
|
||||
_sync_tags(con, existing[0], item.tags)
|
||||
stats["skipped"] += 1
|
||||
continue
|
||||
|
||||
type_id = _TYPE_MAP.get(item.item_type)
|
||||
if type_id is None:
|
||||
stats["skipped"] += 1
|
||||
continue
|
||||
|
||||
# Use the bib key if it looks like a Zotero key (8 alphanum),
|
||||
# otherwise generate a new one
|
||||
key = item.key
|
||||
if not key or len(key) != 8:
|
||||
key = _zotero_key()
|
||||
|
||||
# Check key collision
|
||||
if con.execute(
|
||||
"SELECT 1 FROM items WHERE key = ?", (key,)
|
||||
).fetchone():
|
||||
key = _zotero_key()
|
||||
|
||||
# Insert item
|
||||
cur = con.execute(
|
||||
"""INSERT INTO items
|
||||
(itemTypeID, dateAdded, dateModified,
|
||||
clientDateModified, libraryID, key, version, synced)
|
||||
VALUES (?, ?, ?, ?, 1, ?, 0, 0)""",
|
||||
(type_id, now, now, now, key),
|
||||
)
|
||||
item_id = cur.lastrowid
|
||||
|
||||
# Set fields via EAV
|
||||
fields = _item_to_zotero_fields(item)
|
||||
for field_name, value in fields.items():
|
||||
_set_field(con, item_id, field_name, value)
|
||||
|
||||
# Tags
|
||||
_sync_tags(con, item_id, item.tags)
|
||||
stats["tags"] += len(item.tags)
|
||||
|
||||
# Collection
|
||||
if collection_id is not None:
|
||||
max_order = con.execute(
|
||||
"SELECT COALESCE(MAX(orderIndex), -1) "
|
||||
"FROM collectionItems WHERE collectionID = ?",
|
||||
(collection_id,),
|
||||
).fetchone()[0]
|
||||
con.execute(
|
||||
"INSERT OR IGNORE INTO collectionItems "
|
||||
"(collectionID, itemID, orderIndex) VALUES (?, ?, ?)",
|
||||
(collection_id, item_id, max_order + 1),
|
||||
)
|
||||
stats["collections"] += 1
|
||||
|
||||
# Also add to collections from the bib item
|
||||
for col_key in item.collections:
|
||||
col_row = con.execute(
|
||||
"SELECT collectionID FROM collections WHERE key = ?",
|
||||
(col_key,),
|
||||
).fetchone()
|
||||
if col_row and col_row[0] != collection_id:
|
||||
max_o = con.execute(
|
||||
"SELECT COALESCE(MAX(orderIndex), -1) "
|
||||
"FROM collectionItems WHERE collectionID = ?",
|
||||
(col_row[0],),
|
||||
).fetchone()[0]
|
||||
con.execute(
|
||||
"INSERT OR IGNORE INTO collectionItems "
|
||||
"(collectionID, itemID, orderIndex) VALUES (?, ?, ?)",
|
||||
(col_row[0], item_id, max_o + 1),
|
||||
)
|
||||
|
||||
stats["created"] += 1
|
||||
|
||||
con.commit()
|
||||
con.close()
|
||||
return stats
|
||||
|
||||
|
||||
def _sync_tags(
|
||||
con: sqlite3.Connection, item_id: int, tags: list[str]
|
||||
) -> None:
|
||||
"""Add tags to a Zotero item."""
|
||||
for tag_name in tags:
|
||||
if not tag_name:
|
||||
continue
|
||||
tag_id = _ensure_tag(con, tag_name)
|
||||
con.execute(
|
||||
"INSERT OR IGNORE INTO itemTags (itemID, tagID, type) "
|
||||
"VALUES (?, ?, 0)",
|
||||
(item_id, tag_id),
|
||||
)
|
||||
|
||||
|
||||
def ensure_collection(
|
||||
con: sqlite3.Connection,
|
||||
name: str,
|
||||
parent_key: str = "",
|
||||
) -> str:
|
||||
"""Find or create a Zotero collection. Returns key."""
|
||||
if parent_key:
|
||||
parent = con.execute(
|
||||
"SELECT collectionID FROM collections WHERE key = ?",
|
||||
(parent_key,),
|
||||
).fetchone()
|
||||
parent_id = parent[0] if parent else None
|
||||
else:
|
||||
parent_id = None
|
||||
|
||||
if parent_id is not None:
|
||||
row = con.execute(
|
||||
"SELECT key FROM collections "
|
||||
"WHERE collectionName = ? AND parentCollectionID = ?",
|
||||
(name, parent_id),
|
||||
).fetchone()
|
||||
else:
|
||||
row = con.execute(
|
||||
"SELECT key FROM collections "
|
||||
"WHERE collectionName = ? AND parentCollectionID IS NULL",
|
||||
(name,),
|
||||
).fetchone()
|
||||
|
||||
if row:
|
||||
return row[0]
|
||||
|
||||
key = _zotero_key()
|
||||
con.execute(
|
||||
"""INSERT INTO collections
|
||||
(collectionName, parentCollectionID, clientDateModified,
|
||||
libraryID, key, version, synced)
|
||||
VALUES (?, ?, ?, 1, ?, 0, 0)""",
|
||||
(name, parent_id, _now_iso(), key),
|
||||
)
|
||||
con.commit()
|
||||
return key
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Structured tag vocabulary for module/entity association.
|
||||
"""Structured tag vocabulary for item classification.
|
||||
|
||||
Tags follow ``{namespace}:{value}`` convention so Zotero items
|
||||
can be filtered by module, table, source type, and year.
|
||||
Tags follow ``{namespace}:{value}`` convention so items can be
|
||||
filtered by module, table, source type, and year.
|
||||
|
||||
Namespaces
|
||||
----------
|
||||
@@ -46,9 +46,9 @@ Usage::
|
||||
Tag.file("rvu"),
|
||||
]
|
||||
|
||||
# Convert to Zotero format
|
||||
zotero_tags = [t.to_zotero() for t in tags]
|
||||
# [{'tag': 'module:pfs', 'type': 0}, ...]
|
||||
# Tags are plain strings via .label
|
||||
labels = [t.label for t in tags]
|
||||
# ['module:pfs', 'table:pfs.rvu', ...]
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -57,7 +57,7 @@ from pydantic import BaseModel
|
||||
|
||||
|
||||
class Tag(BaseModel):
|
||||
"""A namespaced tag for Zotero item classification."""
|
||||
"""A namespaced tag for item classification."""
|
||||
|
||||
namespace: str
|
||||
"""Tag namespace (module, table, source, year, rule, file)."""
|
||||
@@ -70,9 +70,8 @@ class Tag(BaseModel):
|
||||
"""Full tag string: ``namespace:value``."""
|
||||
return f"{self.namespace}:{self.value}"
|
||||
|
||||
def to_zotero(self) -> dict[str, str | int]:
|
||||
"""Convert to Zotero tag dict."""
|
||||
return {"tag": self.label, "type": 0}
|
||||
def __str__(self) -> str:
|
||||
return self.label
|
||||
|
||||
@classmethod
|
||||
def from_label(cls, label: str) -> Tag:
|
||||
@@ -113,17 +112,22 @@ class Tag(BaseModel):
|
||||
"""Tag for CMS file type (rvu, gpci, carrier, etc.)."""
|
||||
return cls(namespace="file", value=file_type)
|
||||
|
||||
@classmethod
|
||||
def sup(cls, parent_key: str) -> Tag:
|
||||
"""Tag linking a supplemental item back to its parent."""
|
||||
return cls(namespace="sup", value=parent_key)
|
||||
|
||||
|
||||
def filter_tags(
|
||||
tags: list[dict[str, str | int]],
|
||||
tags: list[str],
|
||||
namespace: str,
|
||||
) -> list[str]:
|
||||
"""Extract values for a given namespace from Zotero tag dicts.
|
||||
"""Extract values for a given namespace from tag strings.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
tags : list[dict]
|
||||
Zotero-format tag list from an item's ``data['tags']``.
|
||||
tags : list[str]
|
||||
Tag label list (e.g. ``['module:pfs', 'year:2026']``).
|
||||
namespace : str
|
||||
Namespace to filter on (e.g. ``"module"``).
|
||||
|
||||
@@ -134,14 +138,13 @@ def filter_tags(
|
||||
|
||||
Example::
|
||||
|
||||
>>> tags = [{'tag': 'module:pfs', 'type': 0},
|
||||
... {'tag': 'year:2026', 'type': 0}]
|
||||
>>> tags = ['module:pfs', 'year:2026']
|
||||
>>> filter_tags(tags, 'module')
|
||||
['pfs']
|
||||
"""
|
||||
prefix = f"{namespace}:"
|
||||
return [
|
||||
t["tag"][len(prefix) :]
|
||||
t[len(prefix):]
|
||||
for t in tags
|
||||
if isinstance(t.get("tag"), str) and t["tag"].startswith(prefix)
|
||||
if isinstance(t, str) and t.startswith(prefix)
|
||||
]
|
||||
|
||||
12
src/bib/ui/__init__.py
Normal file
12
src/bib/ui/__init__.py
Normal file
@@ -0,0 +1,12 @@
|
||||
"""Marimo widgets for bibliography browsing and citation.
|
||||
|
||||
Provides embeddable UI components for marimo notebooks:
|
||||
|
||||
- ``library_browser()`` — interactive library browser
|
||||
- ``cite()`` — inline citation renderer
|
||||
- ``bibliography()`` — reference list renderer
|
||||
"""
|
||||
|
||||
from .browser import library_browser as library_browser
|
||||
from .cite import bibliography as bibliography
|
||||
from .cite import cite as cite
|
||||
122
src/bib/ui/browser.py
Normal file
122
src/bib/ui/browser.py
Normal file
@@ -0,0 +1,122 @@
|
||||
"""Interactive library browser widget for marimo notebooks.
|
||||
|
||||
Usage in a marimo cell::
|
||||
|
||||
from bib.store import Store
|
||||
from bib.ui import library_browser
|
||||
|
||||
store = Store("data/bib.sqlite")
|
||||
library_browser(store)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from bib.store import Store
|
||||
|
||||
|
||||
def library_browser(
|
||||
store: Store,
|
||||
*,
|
||||
collection: str = "",
|
||||
page_size: int = 25,
|
||||
) -> Any:
|
||||
"""Composable library browser using marimo primitives.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
store : Store
|
||||
Bibliography store to browse.
|
||||
collection : str
|
||||
Optional collection key to filter by.
|
||||
page_size : int
|
||||
Number of items per page in the table.
|
||||
|
||||
Returns
|
||||
-------
|
||||
mo.Html
|
||||
Embeddable marimo widget.
|
||||
"""
|
||||
import marimo as mo
|
||||
|
||||
# Search box
|
||||
search = mo.ui.text(placeholder="Search items...", label="Search")
|
||||
|
||||
# Collection sidebar
|
||||
collections = store.list_collections()
|
||||
col_items: dict[str, Any] = {}
|
||||
for c in collections:
|
||||
label = f"{c['name']} ({c['item_count']})"
|
||||
items = store.list_items(collection=c["key"])
|
||||
if items:
|
||||
rows = [
|
||||
{"title": it.title, "type": it.item_type, "key": it.key}
|
||||
for it in items[:page_size]
|
||||
]
|
||||
col_items[label] = mo.ui.table(
|
||||
rows,
|
||||
selection="single",
|
||||
label=c["name"],
|
||||
)
|
||||
|
||||
sidebar = mo.accordion(col_items) if col_items else mo.md("*No collections*")
|
||||
|
||||
# Main item table
|
||||
query = search.value if search.value else ""
|
||||
filters: dict[str, str] = {}
|
||||
if collection:
|
||||
filters["collection"] = collection
|
||||
if query:
|
||||
filters["query"] = query
|
||||
|
||||
all_items = store.list_items(**filters)
|
||||
table_rows = [
|
||||
{
|
||||
"key": it.key,
|
||||
"type": it.item_type,
|
||||
"title": it.title,
|
||||
"date": it.date_published,
|
||||
"tags": "; ".join(it.tags[:3]),
|
||||
}
|
||||
for it in all_items[:page_size]
|
||||
]
|
||||
item_table = mo.ui.table(
|
||||
table_rows,
|
||||
selection="single",
|
||||
label=f"Items ({len(all_items)} total)",
|
||||
)
|
||||
|
||||
# Tags view
|
||||
tag_list = store.list_tags()
|
||||
tag_rows = [
|
||||
{"tag": t["name"], "items": t["count"]}
|
||||
for t in tag_list
|
||||
]
|
||||
tag_table = mo.ui.table(tag_rows, label="Tags") if tag_rows else mo.md("*No tags*")
|
||||
|
||||
# Recent view
|
||||
recent = all_items[:10]
|
||||
recent_rows = [
|
||||
{"title": it.title, "type": it.item_type, "key": it.key}
|
||||
for it in recent
|
||||
]
|
||||
recent_table = (
|
||||
mo.ui.table(recent_rows, label="Recent")
|
||||
if recent_rows
|
||||
else mo.md("*No items*")
|
||||
)
|
||||
|
||||
# Tabs
|
||||
tabs = mo.tabs({
|
||||
"Browse": mo.vstack([search, item_table]),
|
||||
"Collections": sidebar,
|
||||
"Tags": tag_table,
|
||||
"Recent": recent_table,
|
||||
})
|
||||
|
||||
return mo.vstack([
|
||||
mo.md("## Library Browser"),
|
||||
tabs,
|
||||
])
|
||||
87
src/bib/ui/cite.py
Normal file
87
src/bib/ui/cite.py
Normal file
@@ -0,0 +1,87 @@
|
||||
"""Inline citation and bibliography renderers for marimo notebooks.
|
||||
|
||||
Usage in a marimo cell::
|
||||
|
||||
from bib.store import Store
|
||||
from bib.ui import cite, bibliography
|
||||
|
||||
store = Store("data/bib.sqlite")
|
||||
|
||||
# Inline citation
|
||||
cite(store, "ABC12345")
|
||||
|
||||
# Full bibliography
|
||||
keys = [it.key for it in store.list_items(tag="module:pfs")]
|
||||
bibliography(store, keys)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from bib.store import Store
|
||||
|
||||
|
||||
def cite(store: Store, key: str, *, style: str = "apa") -> Any:
|
||||
"""Render an inline citation as styled HTML.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
store : Store
|
||||
Bibliography store.
|
||||
key : str
|
||||
Item key to cite.
|
||||
style : str
|
||||
Citation style (``apa`` or ``bluebook``).
|
||||
|
||||
Returns
|
||||
-------
|
||||
mo.Html
|
||||
Rendered citation.
|
||||
"""
|
||||
import marimo as mo
|
||||
|
||||
text = store.format_citation(key, style=style)
|
||||
return mo.Html(
|
||||
f'<span class="bib-cite" style="font-size: 0.9em;">{text}</span>'
|
||||
)
|
||||
|
||||
|
||||
def bibliography(
|
||||
store: Store,
|
||||
keys: list[str],
|
||||
*,
|
||||
style: str = "apa",
|
||||
) -> Any:
|
||||
"""Render a numbered reference list as styled HTML.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
store : Store
|
||||
Bibliography store.
|
||||
keys : list[str]
|
||||
Item keys to include.
|
||||
style : str
|
||||
Citation style (``apa`` or ``bluebook``).
|
||||
|
||||
Returns
|
||||
-------
|
||||
mo.Html
|
||||
Rendered bibliography.
|
||||
"""
|
||||
import marimo as mo
|
||||
|
||||
lines = []
|
||||
for i, key in enumerate(keys, 1):
|
||||
text = store.format_citation(key, style=style)
|
||||
lines.append(f"<li>{text}</li>")
|
||||
|
||||
html = (
|
||||
'<div class="bib-bibliography" '
|
||||
'style="font-size: 0.9em; line-height: 1.6;">'
|
||||
"<ol>"
|
||||
+ "\n".join(lines)
|
||||
+ "</ol></div>"
|
||||
)
|
||||
return mo.Html(html)
|
||||
11
uv.lock
generated
11
uv.lock
generated
@@ -484,6 +484,15 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/dd/2d/13e6024e613679d8a489dd922f199ef4b1d08a456a58eadd96dc2f05171f/duckdb-1.4.4-cp314-cp314-win_arm64.whl", hash = "sha256:53cd6423136ab44383ec9955aefe7599b3fb3dd1fe006161e6396d8167e0e0d4", size = 13458633, upload-time = "2026-01-26T11:50:17.657Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fsspec"
|
||||
version = "2026.2.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/51/7c/f60c259dcbf4f0c47cc4ddb8f7720d2dcdc8888c8e5ad84c73ea4531cc5b/fsspec-2026.2.0.tar.gz", hash = "sha256:6544e34b16869f5aacd5b90bdf1a71acb37792ea3ddf6125ee69a22a53fb8bff", size = 313441, upload-time = "2026-02-05T21:50:53.743Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e6/ab/fb21f4c939bb440104cc2b396d3be1d9b7a9fd3c6c2a53d98c45b3d7c954/fsspec-2026.2.0-py3-none-any.whl", hash = "sha256:98de475b5cb3bd66bedd5c4679e87b4fdfe1a3bf4d707b151b3c07e58c9a2437", size = 202505, upload-time = "2026-02-05T21:50:51.819Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "google-auth"
|
||||
version = "2.48.0"
|
||||
@@ -1240,6 +1249,7 @@ source = { virtual = "." }
|
||||
dependencies = [
|
||||
{ name = "databricks-cli" },
|
||||
{ name = "databricks-sdk" },
|
||||
{ name = "fsspec" },
|
||||
{ name = "httpx" },
|
||||
{ name = "pyarrow" },
|
||||
{ name = "sqlglot" },
|
||||
@@ -1255,6 +1265,7 @@ dev = [
|
||||
requires-dist = [
|
||||
{ name = "databricks-cli", specifier = ">=0.18.0" },
|
||||
{ name = "databricks-sdk", specifier = ">=0.85.0" },
|
||||
{ name = "fsspec", specifier = ">=2024.1.0" },
|
||||
{ name = "httpx", specifier = ">=0.28.1" },
|
||||
{ name = "pyarrow", specifier = ">=23.0.0" },
|
||||
{ name = "sqlglot", specifier = ">=26.0.0" },
|
||||
|
||||
Reference in New Issue
Block a user