Skip to content

Commit

Permalink
initial work done by Pablo on demographic (#16 #99 SPECITS-70)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-iancu committed Dec 4, 2023
1 parent da4afa8 commit 4f8ad18
Show file tree
Hide file tree
Showing 14 changed files with 249 additions and 6 deletions.
5 changes: 3 additions & 2 deletions development/bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function render() {


case "${1:-}" in
overview|ehr|query|definition|resources)
overview|ehr|query|definition|resources|demographic)
render "$@"
;;
all)
Expand All @@ -28,9 +28,10 @@ case "${1:-}" in
render query
render definition
render resources
render demographic
;;
"")
echo "Usage: bundle.sh [overview|ehr|query|definition|resources]"
echo "Usage: bundle.sh [overview|ehr|query|definition|resources|demographic]"
echo " or: bundle.sh all"
;;
esac
5 changes: 3 additions & 2 deletions development/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function validate() {


case "${1:-}" in
overview|ehr|query|definition|resources)
overview|ehr|query|definition|resources|demographic)
validate "$@"
;;
all)
Expand All @@ -23,6 +23,7 @@ case "${1:-}" in
validate query
validate definition
validate resources
validate demographic
;;
data)
cd ..
Expand All @@ -39,6 +40,6 @@ case "${1:-}" in
docker run -it --rm --name my-maven-project -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.8-openjdk-18 bash
;;
"")
echo "Usage: bundle.sh [overview|ehr|query|definition]"
echo "Usage: bundle.sh [overview|ehr|query|definition|resources|demographic]"
;;
esac
4 changes: 2 additions & 2 deletions development/watch.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
case "${1:-}" in
overview|ehr|query|definition|resources)
overview|ehr|query|definition|resources|demographic)
docker-compose run -d --rm -w "/spec/specifications" -p 80:80 -p 32201:32201 redocly preview-docs "$1".openapi.yaml -h 0.0.0.0 -p 80
;;
"")
echo "Usage: watch.sh [overview|ehr|query|definition]"
echo "Usage: watch.sh [overview|ehr|query|definition|resources|demographic]"
;;
esac
11 changes: 11 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@
"spec_status": "STABLE",
"keywords": "openEHR, ITS, REST APIs, REST, API, RESTful, services, definitions, resources, templates"
},
{
"id": "demographic",
"title": "DEMOGRAPHIC REST API",
"title_short": "DEMOGRAPHIC API",
"description": "openEHR DEMOGRAPHIC REST API",
"summary": "This specification describes service endpoints, resources, functions and operations as well as details of requests and responses that interacts with an openEHR DEMOGRAPHIC API in a RESTful manner.",
"micro_summary": "DEMOGRAPHIC API",
"copyright_year": "2023",
"spec_status": "DRAFT",
"keywords": "openEHR, ITS, REST APIs, REST, API, RESTful, services, DEMOGRAPHIC"
},
{
"id": "simplified_data_template",
"title": "Simplified Data Template (SDT)",
Expand Down
99 changes: 99 additions & 0 deletions specifications/demographic.openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
openapi: 3.0.3
info:
title: Demographic API
version: latest
x-status: DRAFT
x-spec: ehr
contact:
name: Specifications Editorial Committee openEHR
url: 'https://specifications.openehr.org/'
email: [email protected]
license:
name: Creative Commons Attribution-NoDerivs 3.0 Unported
url: 'https://creativecommons.org/licenses/by-nd/3.0/'
#description:
# $ref: ./docs/ehr/Intro.md
servers:
- url: 'https://{baseUrl}/v1'
description: An example openEHR server URL.
variables:
baseUrl:
default: openEHRSys.example.com
description: The (example) server base URL prefix providing openEHR services. This may contain server name, port and base path prefix.
security: []
paths:
'/demographic/actor':
post:
$ref: ./operations/actor_create.yaml
# '/ehr/{ehr_id}/composition/{uid_based_id}':
# get:
# $ref: ./operations/composition_get.yaml
# put:
# $ref: ./operations/composition_update.yaml
# delete:
# $ref: ./operations/composition_delete.yaml
# '/ehr/{ehr_id}/versioned_composition/{versioned_object_uid}':
# get:
# $ref: ./operations/versioned_composition_get.yaml
# '/ehr/{ehr_id}/versioned_composition/{versioned_object_uid}/revision_history':
# get:
# $ref: ./operations/versioned_composition_revision_history.yaml
# '/ehr/{ehr_id}/versioned_composition/{versioned_object_uid}/version':
# get:
# $ref: ./operations/versioned_composition_version_get_at_time.yaml
# '/ehr/{ehr_id}/versioned_composition/{versioned_object_uid}/version/{version_uid}':
# get:
# $ref: ./operations/versioned_composition_version_get_by_id.yaml
# '/ehr/{ehr_id}/directory':
# post:
# $ref: ./operations/directory_create.yaml
# put:
# $ref: ./operations/directory_update.yaml
# delete:
# $ref: ./operations/directory_delete.yaml
# get:
# $ref: ./operations/directory_get_at_time.yaml
# '/ehr/{ehr_id}/directory/{version_uid}':
# get:
# $ref: ./operations/directory_get_by_version_id.yaml
# '/ehr/{ehr_id}/contribution':
# post:
# $ref: ./operations/contribution_create.yaml
# '/ehr/{ehr_id}/contribution/{contribution_uid}':
# get:
# $ref: ./operations/contribution_get.yaml
# tags: TODO: add demographic tags
# - name: DIRECTORY
# description: |
# Management of the [directory](https://specifications.openehr.org/releases/RM/latest/ehr.html#_directory) [FOLDER](https://specifications.openehr.org/releases/RM/latest/common.html#_folder_class) resource.
# Actions upon resources of this group are also formally described in the [I_EHR_DIRECTORY](https://specifications.openehr.org/releases/SM/latest/openehr_platform.html#_i_ehr_directory_interface) Abstract Service Model interface.
# - name: CONTRIBUTION
# description: |
# Management of [CONTRIBUTION](https://specifications.openehr.org/releases/RM/latest/common.html#_contribution_class) resource.
# Actions upon resources of this group are also formally described in the [I_EHR_CONTRIBUTION](https://specifications.openehr.org/releases/SM/latest/openehr_platform.html#_i_ehr_contribution_interface) Abstract Service Model interface.
# - name: DIRECTORY_schema
# x-displayName: DIRECTORY
# description:
# $ref: ./tags/DIRECTORY_schema.md
# - name: CONTRIBUTION_schema
# x-displayName: CONTRIBUTION
# description:
# $ref: ./tags/CONTRIBUTION_schema.md
x-tagGroups:
- name: Resource endpoints
tags:
- DEMOGRAPHIC
- ACTOR
- DIRECTORY
- CONTRIBUTION
- name: Resource schemas
tags:
- DEMOGRAPHIC_schema
- DIRECTORY_schema
- CONTRIBUTION_schema
# components:
# schemas:
# UAbstractItemStructure:
# $ref: ./schemas/data_structures/UAbstractItemStructure.yaml
# UAbstractContentItem:
# $ref: ./schemas/ehr/UAbstractContentItem.yaml
24 changes: 24 additions & 0 deletions specifications/operations/actor_create.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
operationId: actor_create
summary: Create ACTOR
description: |
Creates the first version of a new ACTOR.
tags:
- ACTOR
parameters:
- $ref: ../parameters/header/Prefer.yaml
# FIXME: missing header openEHR-AUDIT_DETAILS.committer
requestBody:
description: |
The ACTOR.
content:
application/json:
schema:
$ref: ../schemas/demographic/Actor.yaml
required: true
# responses:
# '201':
# $ref: ../responses/201_ACTOR.yaml
# '400':
# $ref: ../responses/400_ACTOR.yaml
# '422':
# $ref: ../responses/422_ACTOR.yaml
13 changes: 13 additions & 0 deletions specifications/schemas/data_types/DvIntervalOfDate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
title: DV_INTERVAL_of_DATE
type: object
allOf:
- $ref: ../data_types/DvInterval.yaml
properties:
_type:
type: string
default: DV_INTERVAL
lower:
$ref: ./UMDvDate.yaml
upper:
$ref: ./UMDvDate.yaml
x-discriminator-value: DV_INTERVAL_of_DATE
16 changes: 16 additions & 0 deletions specifications/schemas/demographic/Actor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
title: ACTOR
type: object
allOf:
- $ref: Party.yaml
required:
- languages
properties:
languages:
type: array
items:
$ref: ../data_types/UDvText.yaml
roles:
#for the API roles are embedded in the actor
type: array
items:
$ref: Role.yaml
8 changes: 8 additions & 0 deletions specifications/schemas/demographic/Address.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: ADDRESS
type: object
allOf:
- $ref: ../common/Locatable.yaml
properties:
details:
# FIXME: I don't know which item structure schema to use, there are 3 options
$ref: ../data_structures/UItemStructure.yaml
12 changes: 12 additions & 0 deletions specifications/schemas/demographic/Capability.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
title: CAPABILITY
type: object
allOf:
- $ref: ../common/Locatable.yaml
required:
- credentials
properties:
credentials:
# FIXME: I don't know which item structure schema to use, there are 3 options
$ref: ../data_structures/UItemStructure.yaml
time_validity:
$ref: ../data_types/DvIntervalOfDate.yaml
11 changes: 11 additions & 0 deletions specifications/schemas/demographic/Contact.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: CONTACT
type: object
allOf:
- $ref: ../common/Locatable.yaml
properties:
time_validity:
$ref: ../data_types/DvIntervalOfDate.yaml
addresses:
type: array
items:
$ref: Address.yaml
24 changes: 24 additions & 0 deletions specifications/schemas/demographic/Party.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
title: PARTY
type: object
allOf:
- $ref: ../common/Locatable.yaml
properties:
details:
# FIXME: I don't know which item structure schema to use, there are 3 options
$ref: ../data_structures/UItemStructure.yaml
identities:
type: array
items:
$ref: PartyIdentity.yaml
contacts:
type: array
items:
$ref: Contact.yaml
x-cg-discriminator:
propertyName: _type
mapping:
#ROLE is not allowed on purpose, for the API it's embedded in the ACTOR payload
PERSON: '#/components/schemas/Actor'
ORGANISATION: '#/components/schemas/Actor'
GROUP: '#/components/schemas/Actor'
AGENT: '#/components/schemas/Actor'
8 changes: 8 additions & 0 deletions specifications/schemas/demographic/PartyIdentity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: PARTY_IDENTITY
type: object
allOf:
- $ref: ../common/Locatable.yaml
properties:
details:
# FIXME: I don't know which item structure schema to use, there are 3 options
$ref: ../data_structures/UItemStructure.yaml
15 changes: 15 additions & 0 deletions specifications/schemas/demographic/Role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
title: ROLE
type: object
allOf:
- $ref: Party.yaml
required:
- languages
properties:
time_validity:
$ref: ../data_types/DvIntervalOfDate.yaml
performer:
$ref: ../base_types/PartyRef.yaml
capabilities:
type: array
items:
$ref: Capability.yaml

0 comments on commit 4f8ad18

Please sign in to comment.