All notebooks
Extensions by StructureDefinition + ViewDefinition
Description
13 cells · updated Sep 27, 2024
This is a read-only view. Responses shown were saved when the notebook was published —
open it in your own Aidbox to run the cells against live data.
Create Extension to validate:
extension:
- url: forecastMetrics
extension:
- url: forecastedPayment
valueDecimal: 1
- url: forecastedAt
valueDate: '2000-01-01'
- url: forecastedPaymentDate
valueDate: '2000-01-01'
- url: forecastStatus
valueString: 'status'
REST
Send
Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
POST /fhir/StructureDefinition
content-type: text/yaml
accept: text/yaml
abstract: false
url: forecastMetrics
id: claim-extensions2
name: ClaimExtensions
context:
- type: element
expression: Claim
status: active
kind: complex-type
title: Claim Extensions
type: Extension
baseDefinition: http://hl7.org/fhir/StructureDefinition/Extension
version: 0.0.1
differential:
element:
- id: Extension
max: "1"
min: 0
path: Extension
- id: Extension.extension
min: 1
path: Extension.extension
slicing:
rules: open
discriminator:
- path: url
type: value
- min: 1
sliceName: forecastedAt
max: "1"
path: Extension.extension
id: Extension.extension:forecastedAt
mustSupport: true
type:
- code: Extension
- id: Extension.extension:forecastedAt.url
min: 1
max: "1"
path: Extension.extension.url
type:
- code: uri
fixedUri: forecastedAt
- id: Extension.extension:forecastedAt.value[x]
min: 1
max: "1"
path: Extension.extension.value[x]
type:
- code: date
- min: 1
sliceName: forecastedPaymentDate
max: "1"
path: Extension.extension
id: Extension.extension:forecastedPaymentDate
mustSupport: true
type:
- code: Extension
- id: Extension.extension:forecastedPaymentDate.url
max: "1"
min: 1
path: Extension.extension.url
type:
- code: uri
fixedUri: forecastedPaymentDate
- id: Extension.extension:forecastedPaymentDate.value[x]
max: "1"
min: 1
path: Extension.extension.value[x]
type:
- code: date
- min: 1
sliceName: forecastStatus
max: "1"
path: Extension.extension
id: Extension.extension:forecastStatus
mustSupport: true
type:
- code: Extension
- id: Extension.extension:forecastStatus.url
max: "1"
min: 1
path: Extension.extension.url
type:
- code: uri
fixedUri: forecastStatus
- id: Extension.extension:forecastStatus.value[x]
max: "1"
min: 1
path: Extension.extension.value[x]
type:
- code: string
- min: 1
sliceName: forecastedPayment
max: "1"
path: Extension.extension
id: Extension.extension:forecastedPayment
mustSupport: true
type:
- code: Extension
- id: Extension.extension:forecastedPayment.url
max: "1"
min: 1
path: Extension.extension.url
type:
- code: uri
fixedUri: forecastedPayment
- id: Extension.extension:forecastedPayment.value[x]
max: "1"
min: 1
path: Extension.extension.value[x]
type:
- code: decimal
- id: Extension.url
max: "1"
min: 1
path: Extension.url
fixedUri: forecastMetrics
- id: Extension.value[x]
max: "0"
min: 0
path: Extension.value[x]
resourceType: StructureDefinition
derivation: constraint
Response:
Body
Status:
200
derivation: constraint
name: ClaimExtensions
abstract: false
type: Extension
resourceType: StructureDefinition
title: Claim Extensions
status: active
id: claim-extensions2
kind: complex-type
url: forecastMetrics
context:
- {type: element, expression: Claim}
version: 0.0.1
differential:
element:
- {id: Extension, max: '1', min: 0, path: Extension}
- id: Extension.extension
min: 1
path: Extension.extension
slicing:
rules: open
discriminator:
- {path: url, type: value}
- min: 1
sliceName: forecastedAt
max: '1'
path: Extension.extension
id: Extension.extension:forecastedAt
mustSupport: true
type:
- {code: Extension}
- id: Extension.extension:forecastedAt.url
min: 1
max: '1'
path: Extension.extension.url
type:
- {code: uri}
fixedUri: forecastedAt
- id: Extension.extension:forecastedAt.value[x]
min: 1
max: '1'
path: Extension.extension.value[x]
type:
- {code: date}
- min: 1
sliceName: forecastedPaymentDate
max: '1'
path: Extension.extension
id: Extension.extension:forecastedPaymentDate
mustSupport: true
type:
- {code: Extension}
- id: Extension.extension:forecastedPaymentDate.url
max: '1'
min: 1
path: Extension.extension.url
type:
- {code: uri}
fixedUri: forecastedPaymentDate
- id: Extension.extension:forecastedPaymentDate.value[x]
max: '1'
min: 1
path: Extension.extension.value[x]
type:
- {code: date}
- min: 1
sliceName: forecastStatus
max: '1'
path: Extension.extension
id: Extension.extension:forecastStatus
mustSupport: true
type:
- {code: Extension}
- id: Extension.extension:forecastStatus.url
max: '1'
min: 1
path: Extension.extension.url
type:
- {code: uri}
fixedUri: forecastStatus
- id: Extension.extension:forecastStatus.value[x]
max: '1'
min: 1
path: Extension.extension.value[x]
type:
- {code: string}
- min: 1
sliceName: forecastedPayment
max: '1'
path: Extension.extension
id: Extension.extension:forecastedPayment
mustSupport: true
type:
- {code: Extension}
- id: Extension.extension:forecastedPayment.url
max: '1'
min: 1
path: Extension.extension.url
type:
- {code: uri}
fixedUri: forecastedPayment
- id: Extension.extension:forecastedPayment.value[x]
max: '1'
min: 1
path: Extension.extension.value[x]
type:
- {code: decimal}
- {id: Extension.url, max: '1', min: 1, path: Extension.url, fixedUri: forecastMetrics}
- {id: 'Extension.value[x]', max: '0', min: 0, path: 'Extension.value[x]'}
baseDefinition: http://hl7.org/fhir/StructureDefinition/Extension
Creating resources to check...
REST
Send
Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
PUT /fhir/Patient/pt1
Response:
Body
Status:
200
{
"id": "pt1",
"resourceType": "Patient",
"meta": {
"lastUpdated": "2024-09-27T12:22:48.809420Z",
"versionId": "10",
"extension": [
{
"url": "ex:createdAt",
"valueInstant": "2024-09-27T12:22:48.809420Z"
}
]
}
}
REST
Send
Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
PUT /fhir/Practitioner/p1
Response:
Body
Status:
200
{
"id": "p1",
"resourceType": "Practitioner",
"meta": {
"lastUpdated": "2024-09-27T12:22:43.418194Z",
"versionId": "7",
"extension": [
{
"url": "ex:createdAt",
"valueInstant": "2024-09-27T12:22:43.418194Z"
}
]
}
}
REST
Send
Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
PUT /Coverage/c1
content-type: text/yaml
accept: text/yaml
status: active
beneficiary:
reference: Patient/pt1
payor:
- reference: Patient/pt1
Response:
Body
Status:
200
id: c1
payor:
- {reference: Patient/pt1}
status: active
beneficiary: {reference: Patient/pt1}
resourceType: Coverage
meta: {lastUpdated: '2024-09-27T12:23:19.729370Z', createdAt: '2024-09-27T12:23:19.729370Z', versionId: '14'}
Validation: pass
REST
Send
Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
PUT /fhir/Claim/c1
content-type: text/yaml
accept: text/yaml
extension:
- url: forecastMetrics
extension:
- url: forecastedPayment
valueDecimal: 1
- url: forecastedAt
valueDate: '2000-01-01'
- url: forecastedPaymentDate
valueDate: '2000-01-01'
- url: forecastStatus
valueString: 'status'
use: claim
type:
text: abc
status: active
priority:
text: abc
provider:
reference: Practitioner/p1
patient:
reference: Patient/pt1
insurance:
- sequence: 1
focal: true
coverage:
reference: Coverage/c1
created: '2000-01-01'
Response:
Body
Status:
200
patient: {reference: Patient/pt1}
insurance:
- focal: true
coverage: {reference: Coverage/c1}
sequence: 1
meta:
lastUpdated: '2024-09-27T12:24:02.997201Z'
versionId: '19'
extension:
- {url: 'ex:createdAt', valueInstant: '2024-09-27T12:24:02.997201Z'}
use: claim
type: {text: abc}
created: '2000-01-01'
resourceType: Claim
extension:
- url: forecastMetrics
extension:
- {url: forecastedPayment, valueDecimal: 1}
- {url: forecastedAt, valueDate: '2000-01-01'}
- {url: forecastedPaymentDate, valueDate: '2000-01-01'}
- {url: forecastStatus, valueString: status}
priority: {text: abc}
status: active
id: c1
provider: {reference: Practitioner/p1}
Validation: no forecastStatus
REST
Send
Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
PUT /fhir/Claim/c1
content-type: text/yaml
accept: text/yaml
extension:
- url: forecastMetrics
extension:
- url: forecastedPayment
valueDecimal: 1
- url: forecastedAt
valueDate: '2000-01-01'
- url: forecastedPaymentDate
valueDate: '2000-01-01'
use: claim
type:
text: abc
status: active
priority:
text: abc
provider:
reference: Practitioner/p1
patient:
reference: Patient/pt1
insurance:
- sequence: 1
focal: true
coverage:
reference: Coverage/c1
created: '2000-01-01'
Response:
Body
Status:
422
resourceType: OperationOutcome
text: {status: generated, div: Invalid resource}
issue:
- severity: fatal
code: invalid
expression: ['Claim.extension[0].extension']
diagnostics:
schema-id: claim-extensions2
type: invalid-slice-cardinality
context: {slice-name: forecastStatus, min: '1', max: '1', actual: '0'}
path: extension[0].extension
REST
Send
Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
PUT /ViewDefinition/forecast-view
{
"name": "ForecastView",
"select": [
{
"column": [
{
"name": "forecastedPayment",
"path": "extension('forecastMetrics').extension('forecastedPayment').value.decimal"
},
{
"name": "forecastedAt",
"path": "extension('forecastMetrics').extension('forecastedAt').value.date"
},
{
"name": "forecastedPaymentDate",
"path": "extension('forecastMetrics').extension('forecastedPaymentDate').value.date"
},
{
"name": "forecastStatus",
"path": "extension('forecastMetrics').extension('forecastStatus').value.string"
}
]
}
],
"status": "unknown",
"resource": "Claim",
"id": "315676f6-8314-42eb-95d8-ffe3509d5636",
"extension": []
}
Response:
Body
Status:
200
{
"id": "forecast-view",
"name": "ForecastView",
"select": [
{
"column": [
{
"name": "forecastedPayment",
"path": "extension('forecastMetrics').extension('forecastedPayment').value.decimal"
},
{
"name": "forecastedAt",
"path": "extension('forecastMetrics').extension('forecastedAt').value.date"
},
{
"name": "forecastedPaymentDate",
"path": "extension('forecastMetrics').extension('forecastedPaymentDate').value.date"
},
{
"name": "forecastStatus",
"path": "extension('forecastMetrics').extension('forecastStatus').value.string"
}
]
}
],
"status": "unknown",
"resource": "Claim",
"extension": [],
"resourceType": "ViewDefinition",
"meta": {
"lastUpdated": "2024-09-27T12:35:59.776546Z",
"createdAt": "2024-09-27T12:35:52.437039Z",
"versionId": "43"
}
}
SQL
Send
Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
SELECT * FROM sof.forecastview LIMIT 100Result
| forecastedat | forecaststatus | forecastedpayment | forecastedpaymentdate |
|---|---|---|---|
| 2000-01-01 | status | 1 | 2000-01-01 |
See also:
- Database -> View Definitions
- ViewDefinition Builder: https://sqlonfhir.aidbox.app