Skip to content

Commit 40ea8f2

Browse files
457 early pre published alert pkp integration into sdpi a (#465)
* Draft diagram for new transaction DEV-48 * Changed actors names in DEV-48 transaction diagram * Added Provider selfChecks to DEV-48 transaction diagram * Started carving out transactions DEV-48 and DEV-49 * Corrected actors in transactions DEV-48 and DEV-49 * First big badge of changes for DAS management * Updated SDPi-A actor diagram svg * Attempt to fix PUML diagram rendering issues * 2nd attempt to fix PUML diagram rendering issues * added referenced standards to DEV-48 and -49 * First inroads into DEV-48 message / operation descriptions * Harmonized PUML include paths * Described set_friendly_consumer_name_response * Described operation_monitored_by_das * Corrected step 9 of DEV-48 diagram to be EpisodicAlertReport * Corrected some labels in section 2:3.48.4 * Extended MonitoredByDAS description to also cover DAS maintenance * recreated some lost changes in the last master merge * Fixed merge issues. * Added markup for transactions 48 & 49. * attempt to add simple content and markup for DAS option * 2nd attempt to add simple content and markup for DAS option * removed A-PKP deprecated operation SetFriendlyConsumerName + other updates * fix build error + re-enable PUML file include * first description of operation ConfirmAlertsTechnicalDelivery * fixed roles in DEv-49 + reftext label for DAS option * label fixes in 2:3.48 * completed DEV-48 message descriptions * DEV-48 updates to clarify message semantics and some A-PKP mechanisms * First half of DEV-49 description * Implemented support for multiple actor contributions in transactions. * reverted some changes to DEV-48 (roles that apply to actors) * Continued DEV-49 messaging description * clarified the two situations in DEV-49 * completed DEV-49 description * Added changelog entry --------- Co-authored-by: Paul <PaulMartinsen@users.noreply.github.com>
1 parent eb72391 commit 40ea8f2

21 files changed

Lines changed: 723 additions & 196 deletions

.ci/asciidoc-converter/src/main/kotlin/org/sdpi/asciidoc/extension/SdpiInformationCollector.kt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,11 @@ class SdpiInformationCollector(
11291129
}
11301130
}
11311131

1132+
/*
1133+
Matches actors with contributions for transactions referenced from profiles using
1134+
the syntax in the form:
1135+
sdpi_include_transaction::DEV-23[initiator="required", receiver="optional"]
1136+
*/
11321137
private fun linkActorsToTransactionReferences() {
11331138
for (profile in profiles.values) {
11341139
linkActorsToTransactionReferences(profile.transactionReferences)
@@ -1147,10 +1152,15 @@ class SdpiInformationCollector(
11471152
for (obl in ref.obligations) {
11481153
if (obl.actorId == null) {
11491154
val contrib = obl.contribution
1150-
val role = transaction.actorRoles?.firstOrNull { it.contribution == contrib }
1151-
if (role != null) {
1152-
val strActorId = role.actorId
1153-
obl.actorId = strActorId
1155+
if (transaction.actorRoles != null) {
1156+
val matchingRoles = transaction.actorRoles.filter{it.contributions.contains(contrib)}
1157+
check(matchingRoles.size <= 1) {
1158+
logger.error("More than one actor contributes $contrib. Specify actor in $BLOCK_MACRO_NAME_INCLUDE_TRANSACTION")
1159+
}
1160+
if (matchingRoles.size == 1) {
1161+
val strActorId = matchingRoles[0].actorId
1162+
obl.actorId = strActorId
1163+
}
11541164
}
11551165
}
11561166
}

.ci/asciidoc-converter/src/main/kotlin/org/sdpi/asciidoc/extension/TransactionActorsProcessor.kt

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,32 @@ class TransactionActorsProcessor : BlockProcessor(BLOCK_NAME_TRANSACTION_ACTORS)
5555
val roles = mutableListOf<SdpiActorRole>()
5656

5757
var strActor: String? = null
58-
var contribution: Contribution? = null
58+
var contributions = mutableListOf<Contribution>()
5959
val description = mutableListOf<String>()
6060

6161
for (strLine in blockLines) {
6262
if (strLine.startsWith('[')) {
63-
if (strActor != null && contribution != null && description.isNotEmpty()) {
64-
roles.add(SdpiActorRole(strActor, contribution, description.toList()))
63+
64+
// remove trailing blank lines.
65+
while(description.isNotEmpty() && description.last().isEmpty()) {
66+
description.removeLast()
67+
}
68+
69+
if (strActor != null && contributions.isNotEmpty() && description.isNotEmpty()) {
70+
roles.add(SdpiActorRole(strActor, contributions, description.toList()))
6571
}
6672
description.clear()
6773

6874
val result = parseContributorAttributes(strLine)
6975
strActor = result.first
70-
contribution = result.second
76+
contributions = result.second.toMutableList()
7177
} else {
7278
description.add(strLine)
7379
}
7480
}
7581

76-
if (strActor != null && contribution != null && description.isNotEmpty()) {
77-
roles.add(SdpiActorRole(strActor, contribution, description.toList()))
82+
if (strActor != null && contributions.isNotEmpty() && description.isNotEmpty()) {
83+
roles.add(SdpiActorRole(strActor, contributions, description.toList()))
7884
}
7985

8086
return roles
@@ -104,12 +110,12 @@ class TransactionActorsProcessor : BlockProcessor(BLOCK_NAME_TRANSACTION_ACTORS)
104110

105111
for (actorRole in roles) {
106112
val strActorId = "RefActor:${actorRole.actorId}[]"
107-
val contribution = actorRole.contribution
113+
val contributions = actorRole.contributions
108114
val strDescription = actorRole.description.joinToString("\r\n")
109115

110116
val row = createTableRow(roleTable)
111117
row.cells.add(createTableCell(colActor, strActorId))
112-
row.cells.add(createTableCell(colContribution, contribution.keyword))
118+
row.cells.add(createTableCell(colContribution, contributions.joinToString { it.keyword }))
113119

114120
row.cells.add(createTableCell(colDescription, strDescription))
115121

@@ -119,31 +125,37 @@ class TransactionActorsProcessor : BlockProcessor(BLOCK_NAME_TRANSACTION_ACTORS)
119125
return roleTable
120126
}
121127

122-
private fun parseContributorAttributes(strLine: String): Pair<String, Contribution> {
128+
private fun parseContributorAttributes(strLine: String): Pair<String, List<Contribution>> {
123129
val attributes = parseAttributes(strLine)
124130

125-
val strActorId = attributes[Roles.Transaction.ACTOR_ID.key]
126-
checkNotNull(strActorId) {
131+
val actorId = attributes.firstOrNull{ it.first == Roles.Transaction.ACTOR_ID.key}
132+
checkNotNull(actorId) {
127133
logger.error("Actor in transaction is missing an actor id")
128134
}
129-
val strContribution = attributes[Roles.Transaction.CONTRIBUTION.key]
130-
checkNotNull(strContribution) {
131-
logger.error("Actor $strActorId in transaction is missing a contribution")
135+
val strActorId = actorId.second
136+
val contributions = mutableListOf<Contribution>()
137+
for(contribution in attributes.filter{it.first == Roles.Transaction.CONTRIBUTION.key}) {
138+
val strContribution = contribution.second
139+
val cont = parseContribution(strContribution)
140+
checkNotNull(cont) {
141+
logger.error("Actor $strActorId's contribution '$strContribution' is not recognized")
142+
}
143+
contributions.add(cont)
132144
}
133-
val contribution = parseContribution(strContribution)
134-
checkNotNull(contribution) {
135-
logger.error("Actor $strActorId's contribution '$strContribution' is not recognized")
145+
146+
check(contributions.isNotEmpty()) {
147+
logger.error("Actor $strActorId in transaction is missing a contribution")
136148
}
137149

138-
return Pair(strActorId, contribution)
150+
return Pair(strActorId, contributions)
139151
}
140152

141-
private fun parseAttributes(strValue: String): Map<String, String> {
142-
val attributes = mutableMapOf<String, String>()
153+
private fun parseAttributes(strValue: String): List<Pair<String, String>> {
154+
val attributes = mutableListOf<Pair<String, String>>()
143155

144156
for (match in RE_ATTRIBUTES.findAll(strValue)) {
145157
val (key, value) = match.destructured
146-
attributes[key] = value
158+
attributes.add(Pair<String,String>(key, value))
147159
}
148160

149161
return attributes

.ci/asciidoc-converter/src/main/kotlin/org/sdpi/asciidoc/model/SdpiActor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ data class SdpiActor(
2222
@Serializable
2323
data class SdpiActorRole(
2424
val actorId: String,
25-
val contribution: Contribution,
25+
val contributions: List<Contribution>,
2626
val description: List<String>,
2727
) {
2828
}

.ci/asciidoc-converter/src/main/kotlin/org/sdpi/asciidoc/model/SdpiTransaction.kt

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,14 @@ data class SdpiTransaction(
1919
return "link:#$strAnchor[$id]"
2020
}
2121

22-
fun getContributionFor(contribution: Contribution): Contribution? {
23-
if (actorRoles == null) {
24-
return null
25-
}
26-
27-
for(actor in actorRoles) {
28-
if (actor.contribution == contribution) {
29-
return actor.contribution
30-
}
31-
}
32-
33-
return null
34-
}
35-
36-
fun getContributionForActor(strActorId: String): Contribution? {
22+
fun getContributionForActor(strActorId: String): List<Contribution>? {
3723
if (actorRoles == null) {
3824
return null
3925
}
4026

4127
for(actor in actorRoles) {
4228
if (actor.actorId == strActorId) {
43-
return actor.contribution
29+
return actor.contributions
4430
}
4531
}
4632

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ Each section shall contain a list of action items of the following format: `<bri
1818

1919
### Added
2020

21-
- Clarifying note to R7000 ([#501](https://github.com/IHE/DEV.SDPi/issues/501)).
22-
- Clarifying statements to DEV-23, DEV-24, DEV-46, and DEV-47 w.r.t to ad-hoc and managed mode discovery([#409](https://github.com/IHE/DEV.SDPi/issues/409)).
21+
- Clarifying note to R7000 ([#501](https://github.com/IHE/DEV.SDPi/issues/501))
22+
- Clarifying statements to DEV-23, DEV-24, DEV-46, and DEV-47 w.r.t to ad-hoc and managed mode discovery([#409](https://github.com/IHE/DEV.SDPi/issues/409))
2323
- OID Framework to TF-3Z ([#474](https://github.com/IHE/DEV.SDPi/issues/474))
24+
- Distributed Alarm System option and related transactions DEV-48 and DEV-49 (a.k.a. early "pre-published" integration of the SDC A-PKP standard) ([#457](https://github.com/IHE/DEV.SDPi/issues/457))
2425
- Make restriction of xsd:durations to hours, minutes, seconds, and fractional seconds mandatory for all xsd:duration values ([#517](https://github.com/IHE/DEV.SDPi/issues/517))
2526

2627
### Changes

articles/sdpi-article-ihe-tf-asciidoc-cookbook.adoc

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,9 @@ or overriding obligations that apply when the actor option is selected for a par
475475

476476
A profile, profile option or actor option references a <<semantic-transactions,transaction>> using the `sdpi_include_transaction` [include processor](https://docs.asciidoctor.org/asciidoctorj/latest/extensions/include-processor/) and declares the obligations of contributors.
477477

478-
There are two forms for `sdpi_include_transaction`. The first form defines obligations for the actor roles defined in the transaction. That is, only the contribution (`initiator`, `receiver`, `responder`) and obligation (`required`, `optional`) are required. It is not necessary to repeat the actor. For example:
478+
There are two forms for `sdpi_include_transaction`. The first form defines obligations for the actor roles defined in the transaction. That is, only the contribution (`initiator`, `receiver`, `responder`) and obligation (`required`, `optional`) are required. It is not necessary to repeat the actor provided the transaction actor obligation is not ambiguous. Transaction actor's obligations are ambiguous when more than one actor has the same obligation (e.g., two actors both initiate messages in the transaction).
479+
480+
For example:
479481

480482
[source, asciidoc]
481483
----
@@ -629,6 +631,25 @@ Listens for vol2_clause_dev_23_message_hello messages to identify any <<vol1_spe
629631

630632
Attaching the `transaction` role to a section marks it as a [transaction](https://profiles.ihe.net/DEV/SDPi/index.html#vol2). A (document-unique) identifier must be defined in the `DEV-23` attribute. The `reftext` attribute is used for the transaction label in tables, etc.
631633

634+
Actors may make multiple contributions to a transaction. For example:
635+
636+
----
637+
[sdpi_transaction_actors]
638+
--
639+
640+
[actor-id="somds_medical_alert_consumer",contribution=Initiator,contribution=Receiver]
641+
Requests a <<vol1_spec_sdpi_a_actor_somds_medical_alert_provider>> to end a Distributed Alarm System.
642+
Listens for notifications from a <<vol1_spec_sdpi_a_actor_somds_medical_alert_provider>> that end
643+
a Distributed Alarm System.
644+
645+
[actor-id="somds_medical_alert_provider",contribution=Responder,contribution=Initiator]
646+
Listens for requests from a <<vol1_spec_sdpi_a_actor_somds_medical_alert_consumer>> to end a
647+
Distributed Alarm System and grants such requests. Alternatively ends a Distributed Alarm System
648+
on its own initiative and notifies the <<vol1_spec_sdpi_a_actor_somds_medical_alert_consumer>>.
649+
650+
--
651+
----
652+
632653
The transactions object identifier (oid) may <<defining-oids,be set>> using the `oid-arcs` attribute. If not present, object identifiers will
633654
be set automatically from the transaction id. When assigned automatically, two oids will be applied to each transaction:
634655

0 commit comments

Comments
 (0)