Skip to content

Commit

Permalink
Merge pull request #446 from wearefrank/valueoverrides-dynamic-from-e…
Browse files Browse the repository at this point in the history
…xtraelementen-context

Valueoverrides dynamic from extraelementen context
  • Loading branch information
MLenterman authored Oct 1, 2024
2 parents f7f5734 + 046918d commit 6cb5dd6
Show file tree
Hide file tree
Showing 141 changed files with 8,477 additions and 1,375 deletions.
120 changes: 0 additions & 120 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,126 +142,6 @@ Will result in:
}
```


### Profile Defaults
Profile defaults can be used to configure common translation profile settings. The settings configured in the `profileDefaults` section are applied to **all** zaaktypen. When a regular translation profile for a specific zaaktype is also configured, the settings are merged together. The more specific per zaaktype translation profile will always override any overlapping settings from the `profileDefaults` section. Items in array's like `valuesOverrides` will be combined instead, unless there is an overlapping key. Here the more specific per zaaktype translation profile will also always override any overlapping keys from the ones in the `profileDefaults` section.

For example, the following configuration:
```json
{
"profileDefaults": {
"endCaseEndDate": {
"coalesceResultaat": "Onbekend"
},
"valueOverrides": [
{
"key": "zgw.zaken-api.zaken.zaak.toelichting",
"value": "toelichting from profileDefaults"
}
]
},
"profile": [
{
"zaakTypeIdentificatie": "B9999",
"endDateAndResultLastStatus": {
"coalesceResultaat": "Onbekend"
},
"valueOverrides": [
{
"key": "zgw.zaken-api.zaken.zaak.communicatiekanaal",
"value": "http://example.com"
}
]
},
{
"zaakTypeIdentificatie": "B1026",
"endCaseEndDate": {
"coalesceResultaat": "Toegekend"
},
"valueOverrides": [
{
"key": "zgw.zaken-api.zaken.zaak.toelichting",
"value": "toelichting from specific translation profile"
}
]
}
]
}
```

Will result in:
```json
{
"profile": [
{
"zaakTypeIdentificatie": "B9999",
// highlight-start
"endCaseEndDate": {
"coalesceResultaat": "Onbekend",
},
// highlight-end
"endDateAndResultLastStatus": {
"coalesceResultaat": "Onbekend"
},
"valueOverrides": [
// highlight-start
{
"key": "zgw.zaken-api.zaken.zaak.toelichting",
"value": "toelichting from profileDefaults"
},
// // highlight-end
{
"key": "zgw.zaken-api.zaken.zaak.communicatiekanaal",
"value": "http://example.com"
}
]
},
{
"zaakTypeIdentificatie": "B1026",
"endCaseEndDate": {
// highlight-next-line
"coalesceResultaat": "Toegekend"
},
"valueOverrides": [
{
"key": "zgw.zaken-api.zaken.zaak.toelichting",
// highlight-next-line
"value": "toelichting from specific translation profile"
}
]
}
]
}
```

### Value Overrides
The translations from ZDS/StUF to ZGW are made to be as neutral as possible. With value overrides it is possible to diverge from the generic translation defaults or add static properties.

Value overrides can be configured in `src/main/configurations/Translate/profiles.json` or in the `zaakbrug.profiles` section of the Helm chart.

The keys for the the different properties can be deducted from the OpenApi specification of the API's.
The keys follow the following format: `zgw.<api-name>.<collection-name>.<object-name>.<property>`. For example the key for the zaak property `betalingsindicatie` would be: `zgw.zaken-api.zaken.zaak.betalingsindicatie`. In the translation profile this would look like this:
```json
{
"profile": [
{
"zaakTypeIdentificatie": "example",
"valueOverrides": [
{
"key": "zgw.zaken-api.zaken.zaak.betalingsindicatie",
"value": "nvt"
}
]
}
]
}
```

A value override is only applied if the property's value after the translation from ZDS/StUF to ZGW is **not present, empty string or null**.

Currently this feature implemented for:
- (zaken-api) zaak

## Local Development Docusaurus
1. Navigate to "docusaurus" subfolder with `cd ./docusaurus`.
2. Install dependencies with `npm install`.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
sidebar_position: 100
---

# Configure Value Overrides
The translations from ZDS/StUF to ZGW are made to be as neutral as possible. With value overrides it is possible to diverge from the generic translation defaults or add static properties.

Value overrides can be configured in `src/main/configurations/Translate/profiles.json` or in the `zaakbrug.profiles` section of the Helm chart.

The keys for the the different properties can be deducted from the OpenApi specification of the API's.
The keys follow the following format: `zgw.<api-name>.<collection-name>.<object-name>.<property>`. For example the key for the zaak property `betalingsindicatie` would be: `zgw.zaken-api.zaken.zaak.betalingsindicatie`.

By default a value override is only applied if the property's value after the translation from ZDS/StUF to ZGW is **not present, empty string or null**.

Currently this feature implemented for:
- (zaken-api) zaak
- (zaken-api) rol

### Example: Override zaak.betalingsindicatie to use 'nvt' as default value.
The effect of the value override in this example would be that the zaak property `betalingsindicatie` will be set to `nvt`, only if this value is not already provided in the incoming ZDS message.

In the translation profile this would look like this:
```json
{
"profile": [
{
"zaakTypeIdentificatie": "example",
"valueOverrides": [
{
"key": "zgw.zaken-api.zaken.zaak.betalingsindicatie",
"value": "nvt"
}
]
}
]
}
```

## Dynamic Value Overrides
The basic value overrides mechanism takes a static pre-configured value from the translation profile as override value. Dynamic value overrides allow the value to be determined dynamicly during runtime. This could be an value from the incoming ZDS message for example. The generic syntax to use in the value override's `value` field is as follows:
```
${<context>:<action>}
```

### Value From StUF:extraElement
To use a value from a StUF:extraElement, the `extraElementen` context can be used with the above syntax. When using the `extraElementen` context, the **action** part of the syntax will be the name of the extra element.

Depending on what resource the value override is applied to, the StUF:extraElement will only be looked for in that relevant part of the incoming ZDS message. This means that a StUF:extraElement named `kvkNummer` on a role, is only available to that specific role. A StUF:extraElement value override on the `zgw.zaken-api.rollen.rol` resource cannot use any StUF:extraElement on any other resource. In short; A value override on the case can only use a StUF:extraElement that is present on the case itself; A value override on a role can only use a StUF:extraElement from that specific role.

### Example: Override nietNatuurlijkPersoon role 'annIdentificatie' field with StUF:extraElement naam="kvkNummer".

In the translation profile it would look like this:
```json
{
"profile": [
{
"zaakTypeIdentificatie": "example",
"valueOverrides": [
// highlight-start
{
"key": "zgw.zaken-api.rollen.rol.betrokkeneIdentificatie.annIdentificatie",
"value": "${extraElementen:kvkNummer}",
"condition": "true()"
}
// highlight-end
]
}
]
}
```

The incoming ZDS message might look something like this:
```xml
<ZKN:zakLk01>
...
<ZKN:object StUF:entiteittype="ZAK" StUF:verwerkingssoort="T">
...
<ZKN:heeftAlsInitiator StUF:entiteittype="ZAKBTRINI" StUF:verwerkingssoort="T">
<ZKN:gerelateerde>
<ZKN:nietNatuurlijkPersoon StUF:entiteittype="NNP" StUF:verwerkingssoort="T">
<BG:inn.nnpId>823288444</BG:inn.nnpId>
<BG:authentiek StUF:metagegeven="true">N</BG:authentiek>
<BG:statutaireNaam>SjaakZnZaak</BG:statutaireNaam>
<BG:inn.rechtsvorm>Eenmanszaak</BG:inn.rechtsvorm>
<BG:bezoekadres>
<BG:aoa.identificatie>0091200000046730</BG:aoa.identificatie>
<BG:authentiek StUF:metagegeven="true">J</BG:authentiek>
<BG:wpl.woonplaatsNaam>Sneek</BG:wpl.woonplaatsNaam>
<BG:gor.openbareRuimteNaam>Marktstraat</BG:gor.openbareRuimteNaam>
<BG:gor.straatnaam>Marktstraat</BG:gor.straatnaam>
<BG:aoa.postcode>8601CR</BG:aoa.postcode>
<BG:aoa.huisnummer>15</BG:aoa.huisnummer>
<BG:aoa.huisletter xsi:nil="true" StUF:noValue="geenWaarde"/>
<BG:aoa.huisnummertoevoeging/>
<BG:inp.locatiebeschrijving xsi:nil="true" StUF:noValue="geenWaarde"/>
</BG:bezoekadres>
</ZKN:nietNatuurlijkPersoon>
</ZKN:gerelateerde>
// highlight-start
<StUF:extraElementen>
<StUF:extraElement naam="kvkNummer">12345678</StUF:extraElement>
</StUF:extraElementen>
// highlight-end
</ZKN:heeftAlsInitiator>
...
</ZKN:object>
</ZKN:zakLk01>

```

This results in ZaakBrug taking the value from StUF:extraElement named `kvkNummer` present on the role in question from the incoming ZDS message. Before the translated role is passed to the ZGW API's, the `annIdentificatie` field under betrokkeneIdentificatie is filled with this value.

When retrieving a case with this role with a `geefZaakDetails` ZDS message for example, the reverse is done aswell. In the response message, contained within the role in question, an StUF:extraElement named `kvkNummer` will be added with the value taken from `annIdentificatie` field under betrokkeneIdentificatie.

:::warning
Currently it is necessary to add `"condition": "true()"` to every dynamic value override from StUF:extraElement.
:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
sidebar_position: 100
---

# Translation Profiles

- [Configure Value Overrides](configure-value-overrides)
- [Set Defaults For All Profiles](set-defaults-all-profiles)
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
sidebar_position: 100
---

# Set Defaults For All Profiles

Profile defaults can be used to configure common translation profile settings. The settings configured in the `profileDefaults` section are applied to **all** zaaktypen. When a regular translation profile for a specific zaaktype is also configured, the settings are merged together. The more specific per zaaktype translation profile will always override any overlapping settings from the `profileDefaults` section. Items in array's like `valuesOverrides` will be combined instead, unless there is an overlapping key. Here the more specific per zaaktype translation profile will also always override any overlapping keys from the ones in the `profileDefaults` section.

For example, the following configuration:
```json
{
"profileDefaults": {
"endCaseEndDate": {
"coalesceResultaat": "Onbekend"
},
"valueOverrides": [
{
"key": "zgw.zaken-api.zaken.zaak.toelichting",
"value": "toelichting from profileDefaults"
}
]
},
"profile": [
{
"zaakTypeIdentificatie": "B9999",
"endDateAndResultLastStatus": {
"coalesceResultaat": "Onbekend"
},
"valueOverrides": [
{
"key": "zgw.zaken-api.zaken.zaak.communicatiekanaal",
"value": "http://example.com"
}
]
},
{
"zaakTypeIdentificatie": "B1026",
"endCaseEndDate": {
"coalesceResultaat": "Toegekend"
},
"valueOverrides": [
{
"key": "zgw.zaken-api.zaken.zaak.toelichting",
"value": "toelichting from specific translation profile"
}
]
}
]
}
```

Will result in:
```json
{
"profile": [
{
"zaakTypeIdentificatie": "B9999",
// highlight-start
"endCaseEndDate": {
"coalesceResultaat": "Onbekend",
},
// highlight-end
"endDateAndResultLastStatus": {
"coalesceResultaat": "Onbekend"
},
"valueOverrides": [
// highlight-start
{
"key": "zgw.zaken-api.zaken.zaak.toelichting",
"value": "toelichting from profileDefaults"
},
// highlight-end
{
"key": "zgw.zaken-api.zaken.zaak.communicatiekanaal",
"value": "http://example.com"
}
]
},
{
"zaakTypeIdentificatie": "B1026",
"endCaseEndDate": {
// highlight-next-line
"coalesceResultaat": "Toegekend"
},
"valueOverrides": [
{
"key": "zgw.zaken-api.zaken.zaak.toelichting",
// highlight-next-line
"value": "toelichting from specific translation profile"
}
]
}
]
}
```
Loading

0 comments on commit 6cb5dd6

Please sign in to comment.