### Start Haal Centraal BRP API Mock
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/v2/getting-started.md
This command uses Docker Compose to start the Haal Centraal BRP API mock in a detached mode. It makes the API accessible locally for testing and development.
```sh
docker-compose -f docker-compose-mock.yml up -d
```
--------------------------------
### Stop Haal Centraal BRP API Mock
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/v2/getting-started.md
This command uses Docker Compose to stop and remove the containers, networks, and volumes associated with the Haal Centraal BRP API mock, effectively shutting down the local environment.
```sh
docker-compose -f docker-compose-mock.yml down
```
--------------------------------
### Validate Haal Centraal BRP API Mock with cURL
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/v2/getting-started.md
This cURL command sends a POST request to the locally running Haal Centraal BRP API mock. It queries for a person using a specific 'burgerservicenummer' (citizen service number) to verify the API's functionality.
```sh
curl --location --request POST 'http://localhost:5010/haalcentraal/api/brp/personen' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "RaadpleegMetBurgerservicenummer",
"burgerservicenummer": ["999993653"],
"fields": ["burgerservicenummer"]
}'
```
--------------------------------
### Install Node.js Dependencies
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/scripts/upsert-landelijk-tabel-data-readme.md
Executes the npm install command to set up all necessary Node.js packages required for the project. This step should be performed once.
```Shell
npm install
```
--------------------------------
### Query BRP Person Foreign Residence Start Date and Address Function Fields
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-verblijfplaats-gba.html
This scenario demonstrates how to retrieve multiple fields, 'datumVan' (start date) and 'functieAdres' (address function), of a foreign residence ('verblijfplaats') for a person identified by their citizen service number, including various address lines as preconditions. It shows the input parameters for the query and the expected response containing the land details and the start date.
```APIDOC
Preconditions:
Person with burgerservicenummer '000000152' has the following 'verblijfplaats' data:
datum aanvang adres buitenland (13.20): 20150808
land adres buitenland (13.10): 6014
regel 1 adres buitenland (13.30): 1600 Pennsylvania Avenue NW
regel 2 adres buitenland (13.40): Washington, DC 20500
regel 3 adres buitenland (13.50): Selangor
API Request:
Operation: RaadpleegMetBurgerservicenummer
Parameters:
burgerservicenummer: 000000152
fields: verblijfplaats.datumVan,verblijfplaats.functieAdres
Expected Response:
verblijfplaats:
land.code: 6014
land.omschrijving: Verenigde Staten van Amerika
datumAanvangAdresBuitenland: 20150808
```
--------------------------------
### Query BRP Person Foreign Residence Start Date Field
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-verblijfplaats-gba.html
This scenario demonstrates how to retrieve the 'datumVan' (start date) field of a foreign residence ('verblijfplaats.datumVan') for a person identified by their citizen service number, including various address lines as preconditions. It shows the input parameters for the query and the expected response containing the land details and the start date.
```APIDOC
Preconditions:
Person with burgerservicenummer '000000152' has the following 'verblijfplaats' data:
datum aanvang adres buitenland (13.20): 20150808
land adres buitenland (13.10): 6014
regel 1 adres buitenland (13.30): 1600 Pennsylvania Avenue NW
regel 2 adres buitenland (13.40): Washington, DC 20500
regel 3 adres buitenland (13.50): Selangor
API Request:
Operation: RaadpleegMetBurgerservicenummer
Parameters:
burgerservicenummer: 000000152
fields: verblijfplaats.datumVan
Expected Response:
verblijfplaats:
land.code: 6014
land.omschrijving: Verenigde Staten van Amerika
datumAanvangAdresBuitenland: 20150808
```
--------------------------------
### Initialize Swagger UI for BRP Personen API
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/v1/swagger-ui.html
This JavaScript snippet initializes Swagger UI to display the OpenAPI specification for the Haal Centraal BRP Personen API. It loads the YAML specification from a GitHub raw content URL and configures the UI with deep linking, standard presets, and a base layout.
```JavaScript
window.onload = function() {
const ui = SwaggerUIBundle({
url: "https://raw.githubusercontent.com/BRP-API/Haal-Centraal-BRP-bevragen/v1.3.1/specificatie/genereervariant/openapi.yaml",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "BaseLayout"
})
window.ui = ui
}
```
--------------------------------
### Initialize Google Charts for Report Visualization
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/features/test-report-persoon-leeftijd-gba.html
Initializes the Google Visualization API with the 'corechart' package and sets up callbacks to draw charts for 'Features' and 'Scenarios' results upon page load. This is used to display test execution statistics.
```JavaScript
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(function () { drawChart({ "title": "Features", "failed": 0, "passed": 1, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
google.setOnLoadCallback(function () { drawChart({ "title": "Scenarios", "failed": 0, "passed": 2, "rerun": 0, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
```
--------------------------------
### APIDOC: GBA Person Search API Parameters
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/features/test-report-persoon-verblijfstitel-gba.html
Specifies the parameters used when searching for persons in the GBA (Municipal Personal Records Database) system. This example illustrates how to search using a 'burgerservicenummer' (citizen service number) and request specific fields like 'verblijfstitel'.
```APIDOC
GBA Person Search Parameters:
Type: RaadpleegMetBurgerservicenummer (ConsultByCitizenServiceNumber)
Parameters:
burgerservicenummer: string (e.g., '000000243')
fields: array of strings (e.g., ['verblijfstitel'])
```
--------------------------------
### Initialize Google Charts and Draw Report Charts
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-naam-gba.html
Initializes the Google Visualization API and sets up callbacks to draw two pie charts: one for 'Features' and one for 'Scenarios', displaying test results based on provided chart data.
```javascript
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(function () { drawChart({ "title": "Features", "failed": 0, "passed": 2, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
google.setOnLoadCallback(function () { drawChart({ "title": "Scenarios", "failed": 0, "passed": 15, "rerun": 0, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
function drawChart(chartData) {
let data = google.visualization.arrayToDataTable([
['Task', 'Cucumber Results'],
['Passed', chartData.passed],
['Failed', chartData.failed],
['Pending', chartData.pending],
['Undefined', chartData.notdefined],
['Ambiguous', chartData.ambiguous],
['Skipped', chartData.skipped],
['Re-run', chartData.rerun]
]);
let total = chartData.passed + chartData.failed + (chartData.pending || 0) + (chartData.notdefined || 0) + (chartData.ambiguous || 0) + (chartData.skipped || 0) || chartData.rerun || 0;
let title;
if (total === 1) {
title = total + ' ' + chartData.title.slice(0, -1);
} else {
title = total + ' ' + chartData.title;
}
let options = {
width: '100%',
height: 240,
title: title,
is3D: true,
colors: ['#5cb85c', '#d9534f', '#999', '#5bc0de', '#428bca', '#f0ad4e', '#ff9933'],
fontSize: '13',
fontName: '"Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif',
slices: {
1: { offset: 0.4 },
2: { offset: 0.4 },
3: { offset: 0.4 },
4: { offset: 0.4 },
5: { offset: 0.4 },
6: { offset: 0.4 },
7: { offset: 0.4 }
},
titleTextStyle: {
fontSize: '13',
color: '#5e5e5e'
}
};
let chart = new google.visualization.PieChart(document.getElementById('piechart_' + chartData.title.toLowerCase()));
chart.draw(data, options);
}
```
--------------------------------
### Initialize Google Charts for Test Result Visualization
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/features/test-report-persoon-kind-gba.html
JavaScript code to load the Google Visualization API and set up callbacks to draw pie charts for 'Features' and 'Scenarios' test results upon page load.
```JavaScript
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(function () { drawChart({ "title": "Features", "failed": 0, "passed": 3, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
google.setOnLoadCallback(function () { drawChart({ "title": "Scenarios", "failed": 0, "passed": 16, "rerun": 0, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
```
--------------------------------
### BRP API: Retrieve Person Data with Children Scenario
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/features/test-report-persoon-kind-gba.html
A Gherkin-style scenario describing the interaction with the BRP API to retrieve person data. It details the setup (person with children, including a stillborn child), the API call parameters (BSN, fields to retrieve), and the expected response structure.
```Gherkin
Scenario: de persoon heeft een levenloos geboren kind en een levend kind
Gegeven de persoon met burgerservicenummer '000000073' heeft een 'kind' met de volgende gegevens
voornamen (02.10)
Bert
En de persoon heeft nog een 'kind' met de volgende gegevens
voornamen (02.10)
registratie betrekking (89.10)
Ernie
L
Als gba personen wordt gezocht met de volgende parameters
naam
waarde
type
RaadpleegMetBurgerservicenummer
burgerservicenummer
000000073
fields
kinderen.naam.voornamen
Dan heeft de response een persoon met een 'kind' met de volgende 'naam' gegevens
naam
waarde
voornamen
Bert
```
--------------------------------
### Initialize Google Charts and Draw Report Charts
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/features/test-report-persoon-adressering-gba.html
Initializes the Google Visualization API and sets up callbacks to draw pie charts for 'Features' and 'Scenarios' based on provided data, typically used for displaying test report summaries.
```JavaScript
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(function () { drawChart({ "title": "Features", "failed": 0, "passed": 6, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
google.setOnLoadCallback(function () { drawChart({ "title": "Scenarios", "failed": 0, "passed": 110, "rerun": 0, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
```
--------------------------------
### Load BRP Query Fields List with JavaScript
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/v2/fields.html
This function fetches a list of allowed fields for a selected document type from a remote CSV file. It uses XMLHttpRequest to perform an asynchronous GET request and then calls `renderFieldSelectors` upon successful retrieval. It handles network errors by updating the UI.
```javascript
loadFieldsList();
function loadFieldsList() {
// haal de lijst met toegestane velden op voor het geselecteerde type document.
document.getElementById("fields").value = "";
var responseObjectName = document.getElementById("searchType").value;
var ajaxRequest = new XMLHttpRequest();
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
if(ajaxRequest.status == 200){
renderFieldSelectors(responseObjectName, ajaxRequest.responseText.split(/\r?\n/))
} else {
document.getElementById("selectors").innerHTML = "Status error: " + ajaxRequest.status;
}
}
}
ajaxRequest.open("GET", "https://raw.githubusercontent.com/BRP-API/Haal-Centraal-BRP-bevragen/master/features/fields-filtered-" + responseObjectName + ".csv", true);
ajaxRequest.send();
}
```
--------------------------------
### Initialize Google Charts and Render Report Summaries
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-europees-kiesrecht-gba.html
Initializes the Google Visualization library and draws two pie charts on page load. One chart summarizes 'Features' and the other 'Scenarios' based on predefined data, typically used for displaying test report results.
```JavaScript
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(function () { drawChart({ "title": "Features", "failed": 0, "passed": 1, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
google.setOnLoadCallback(function () { drawChart({ "title": "Scenarios", "failed": 0, "passed": 21, "rerun": 0, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
```
--------------------------------
### Initialize Google Charts and Draw Report Charts
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-verificatie.html
Initializes the Google Visualization API with the 'corechart' package and sets up callbacks to draw two pie charts, 'Features' and 'Scenarios', displaying pass/fail/pending statistics for a report.
```javascript
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(function () { drawChart({ "title": "Features", "failed": 0, "passed": 1, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
google.setOnLoadCallback(function () { drawChart({ "title": "Scenarios", "failed": 0, "passed": 17, "rerun": 0, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
```
--------------------------------
### Implement Global Collapse/Expand All Functionality
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/features/test-report-persoon-leeftijd-gba.html
Provides functions to collapse or expand all elements with `data-toggle="collapse"` attributes. Event listeners are attached to 'collapse all' and 'expand all' buttons to trigger these actions, improving navigation for large reports.
```JavaScript
$(document).ready(function () {
const $collapsibleItems = $('[data-toggle="collapse"]');
const $collapseAllBtn = $('#collapse_all');
const $expandAllBtn = $('#expand_all');
const collapseAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('hide');
});
};
const expandAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('show');
});
};
$collapseAllBtn.on('click', collapseAll);
$expandAllBtn.on('click', expandAll);
});
```
--------------------------------
### Initialize Google Charts for Report Visualization
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-leeftijd.html
Initializes the Google Visualization library with the 'corechart' package and sets up callbacks to draw charts for 'Features' and 'Scenarios' data. This is typically used for displaying test report statistics.
```JavaScript
google.load("visualization", "1", { packages: ["corechart"] }); google.setOnLoadCallback(function () { drawChart({ "title": "Features", "failed": 0, "passed": 2, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) }); google.setOnLoadCallback(function () { drawChart({ "title": "Scenarios", "failed": 0, "passed": 17, "rerun": 0, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
```
--------------------------------
### Initialize Google Charts for Reporting
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-leeftijd-gba.html
Loads the Google Visualization API with the 'corechart' package and sets up callbacks to draw pie charts for 'Features' and 'Scenarios' based on provided data, typically used in automated test reporting dashboards.
```JavaScript
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(function () { drawChart({ "title": "Features", "failed": 0, "passed": 1, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
google.setOnLoadCallback(function () { drawChart({ "title": "Scenarios", "failed": 0, "passed": 2, "rerun": 0, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
```
--------------------------------
### Implement Bootstrap Collapse/Expand and Timestamp Update
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/features/test-report-persoon-adressering-gba.html
Handles Bootstrap collapse events to toggle the 'open' class on preceding elements and updates the report generation timestamp to a human-readable format using Moment.js.
```JavaScript
$(document).ready(function () {
$('.collapse')
.on('hide.bs.collapse', function (e) {
e.stopPropagation();
$(this).prev().removeClass('open');
})
.on('show.bs.collapse', function (e) {
e.stopPropagation();
$(this).prev().addClass('open');
});
let $generated = $('.generated-on');
let timestamp = $generated.text();
$generated.text('Report generated ' + moment(timestamp).fromNow());
$generated.prop('title', new Date(timestamp).toISOString());
});
```
--------------------------------
### JavaScript: Initialize Google Charts for Report Visualization
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-naam.html
This JavaScript code initializes the Google Visualization library and sets up callbacks to draw charts for 'Features' and 'Scenarios' data. It ensures the charts are rendered once the Google Charts library is loaded.
```javascript
google.load("visualization", "1", { packages: ["corechart"] }); google.setOnLoadCallback(function () { drawChart({ "title": "Features", "failed": 0, "passed": 4, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) }); google.setOnLoadCallback(function () { drawChart({ "title": "Scenarios", "failed": 0, "passed": 111, "rerun": 0, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
```
--------------------------------
### GBA Variant API Documentation Viewer Configuration
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/v2/redoc-gba.md
This snippet configures the Redoc API documentation viewer to display the GBA variant API specification. It points to the OpenAPI specification URL for version 2.0.0 of the GBA API.
```APIDOC
```
--------------------------------
### Global Collapse/Expand All Buttons for UI Elements
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/features/test-report-persoon-adressering-gba.html
Attaches click handlers to 'collapse all' and 'expand all' buttons, allowing users to globally control the visibility of all collapsible UI elements on the page.
```JavaScript
$(document).ready(function () {
const $collapsibleItems = $('\[data-toggle="collapse"\]');
const $collapseAllBtn = $('#collapse_all');
const $expandAllBtn = $('#expand_all');
const collapseAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('hide');
});
};
const expandAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('show');
});
};
$collapseAllBtn.on('click', collapseAll);
$expandAllBtn.on('click', expandAll);
});
```
--------------------------------
### JavaScript: Document Ready Handlers for UI Collapse/Expand
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-naam.html
This script defines event handlers that run when the document is ready. It manages the collapse and expand behavior of UI elements, updates report generation timestamps, and provides 'collapse all' and 'expand all' functionality for collapsible sections.
```javascript
$(document).ready(function () { $('.collapse') .on('
```
--------------------------------
### Initialize Google Charts for Report Data
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/features/test-report-persoon-gezagsverhouding.html
Loads the Google Visualization API and sets up callbacks to draw 'Features' and 'Scenarios' charts upon page load, using predefined data structures.
```javascript
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(function () { drawChart({ "title": "Features", "failed": 0, "passed": 2, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
google.setOnLoadCallback(function () { drawChart({ "title": "Scenarios", "failed": 0, "passed": 19, "rerun": 0, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
```
--------------------------------
### Initialize Google Charts for Report Visualization
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/features/test-report-persoon-leeftijd.html
Loads the Google Visualization library and sets callbacks to draw charts for 'Features' and 'Scenarios' data upon page load. This is typically used for displaying test report statistics.
```JavaScript
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(function () {
drawChart({ "title": "Features", "failed": 0, "passed": 2, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 })
});
google.setOnLoadCallback(function () {
drawChart({ "title": "Scenarios", "failed": 0, "passed": 17, "rerun": 0, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 })
});
```
--------------------------------
### Implement Global Collapse/Expand All Functionality
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-europees-kiesrecht-gba.html
jQuery document ready function that sets up click handlers for 'collapse all' and 'expand all' buttons. These handlers iterate through all elements with `data-toggle="collapse"` and trigger the respective Bootstrap collapse actions (hide or show).
```JavaScript
$(document).ready(function () {
const $collapsibleItems = $('[data-toggle="collapse"]');
const $collapseAllBtn = $('#collapse_all');
const $expandAllBtn = $('#expand_all');
const collapseAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('hide');
});
};
const expandAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('show');
});
};
$collapseAllBtn.on('click', collapseAll);
$expandAllBtn.on('click', expandAll);
});
```
--------------------------------
### Initialize Google Charts and UI Collapse Behavior
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-gezagsverhouding.html
This JavaScript snippet initializes Google Charts for displaying feature and scenario statistics as pie charts. It also sets up event listeners for Bootstrap collapse elements to manage their open/close states and updates a 'generated on' timestamp to a relative time.
```javascript
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(function () { drawChart({ "title": "Features", "failed": 0, "passed": 2, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
google.setOnLoadCallback(function () { drawChart({ "title": "Scenarios", "failed": 0, "passed": 19, "rerun": 0, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
$(document).ready(function () {
$('.collapse')
.on('hide.bs.collapse', function (e) {
e.stopPropagation();
$(this).prev().removeClass('open');
})
.on('show.bs.collapse', function (e) {
e.stopPropagation();
$(this).prev().addClass('open');
});
let $generated = $('.generated-on');
let timestamp = $generated.text();
$generated.text('Report generated ' + moment(timestamp).fromNow());
$generated.prop('title', new Date(timestamp).toISOString());
});
```
--------------------------------
### Configure BrpProxy Logging Level to Information (Docker Compose)
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/v2/brpproxy-configuratie.html
This Docker Compose snippet shows how to adjust the BrpProxy's logging level to 'Information'. By setting the `Serilog__MinimumLevel__Override__BrpProxy` environment variable, all requests, including their request bodies, will be logged, providing more detailed insights for debugging and monitoring.
```yaml
brpproxy:
container_name: brpproxy
image: iswish/haal-centraal-brp-bevragen-proxy:latest
environment:
- ASPNETCORE_ENVIRONMENT=Release
- ASPNETCORE_URLS=http://+:5000
- Serilog__MinimumLevel__Override__BrpProxy=Information
ports:
- "5001:5000"
```
--------------------------------
### Implement Collapse/Expand All Functionality
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/features/test-report-persoon-gezagsverhouding.html
Sets up click handlers for 'collapse all' and 'expand all' buttons. These functions iterate through all elements with `data-toggle="collapse"` and trigger their respective Bootstrap collapse actions (hide or show).
```javascript
$(document).ready(function () {
const $collapsibleItems = $('[data-toggle="collapse"]');
const $collapseAllBtn = $('#collapse_all');
const $expandAllBtn = $('#expand_all');
const collapseAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('hide');
});
};
const expandAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('show');
});
};
$collapseAllBtn.on('click', collapseAll);
$expandAllBtn.on('click', expandAll);
});
```
--------------------------------
### Implement Collapse/Expand All for UI Elements
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/features/test-report-persoon-leeftijd.html
Provides functionality to collapse or expand all elements with the 'data-toggle="collapse"' attribute. It attaches click handlers to 'collapse_all' and 'expand_all' buttons to trigger the respective actions.
```JavaScript
$(document).ready(function () {
const $collapsibleItems = $('[data-toggle="collapse"]');
const $collapseAllBtn = $('#collapse_all');
const $expandAllBtn = $('#expand_all');
const collapseAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('hide');
});
};
const expandAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('show');
});
};
$collapseAllBtn.on('click', collapseAll);
$expandAllBtn.on('click', expandAll);
});
```
--------------------------------
### Implement Global Collapse/Expand All Functionality
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-verificatie.html
Provides functions to globally collapse or expand all elements with `data-toggle="collapse"` attributes, triggered by dedicated 'collapse all' and 'expand all' buttons.
```javascript
$(document).ready(function () {
const $collapsibleItems = $('\[data-toggle="collapse"\]');
const $collapseAllBtn = $('#collapse_all');
const $expandAllBtn = $('#expand_all');
const collapseAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('hide');
});
};
const expandAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('show');
});
};
$collapseAllBtn.on('click', collapseAll);
$expandAllBtn.on('click', expandAll);
});
```
--------------------------------
### Implement Global Collapse/Expand All Functionality
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-naam-gba.html
Adds event listeners to 'Collapse All' and 'Expand All' buttons, allowing users to toggle the visibility of all collapsible UI elements simultaneously by iterating through elements with 'data-toggle="collapse"' attribute.
```javascript
$(document).ready(function () {
const $collapsibleItems = $('[data-toggle="collapse"]');
const $collapseAllBtn = $('#collapse_all');
const $expandAllBtn = $('#expand_all');
const collapseAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('hide');
});
};
const expandAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('show');
});
};
$collapseAllBtn.on('click', collapseAll);
$expandAllBtn.on('click', expandAll);
});
```
--------------------------------
### OpenAPI Specification Reference for BRP API
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/v1/swagger-ui.md
This entry points to the OpenAPI specification (v1.3.1) for the Haal Centraal BRP Bevragen API. This specification is used by Swagger UI to generate interactive API documentation, detailing endpoints, request/response schemas, and available operations.
```APIDOC
https://raw.githubusercontent.com/BRP-API/Haal-Centraal-BRP-bevragen/v1.3.1/specificatie/genereervariant/openapi.yaml
```
--------------------------------
### Implement Collapse/Expand All for UI Elements
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-leeftijd.html
Provides functionality to collapse or expand all elements marked with `data-toggle="collapse"` within the document. This improves user experience by allowing bulk control over collapsible sections, typically in a report or documentation view.
```JavaScript
$(document).ready(function () { const $collapsibleItems = $('[data-toggle="collapse"]'); const $collapseAllBtn = $('#collapse_all'); const $expandAllBtn = $('#expand_all'); const collapseAll = function () { $collapsibleItems.each(function () { $($(this).attr('href')).collapse('hide'); }); }; const expandAll = function () { $collapsibleItems.each(function () { $($(this).attr('href')).collapse('show'); }); }; $collapseAllBtn.on('click', collapseAll); $expandAllBtn.on('click', expandAll); });
```
--------------------------------
### Mount BrpProxy Routing Configuration File with Volume Mount (Kubernetes)
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/v2/brpproxy-configuratie.html
This Kubernetes YAML snippet demonstrates how to mount an external Ocelot JSON configuration file to a BrpProxy container instance using a volume mount. It defines a volume named `brpproxy-routing-configuration` and mounts it to `/app/configuration` inside the container, allowing the proxy to use the external routing settings.
```yaml
containers:
- name: brpproxy
image: iswish/haal-centraal-brp-bevragen-proxy:latest
env:
- name: ASPNETCORE_ENVIRONMENT
value: Release
- name: ASPNETCORE_URLS
value: http://+:5000
ports:
- name: http-brpproxy
containerPort: 5000
volumeMounts:
- name: brpproxy-routing-configuration
mountPath: /app/configuration
volumes:
- name: brpproxy-routing-configuration
hostPath:
path: /Haal-Centraal-BRP-bevragen/src/config/BrpProxy/configuration
```
--------------------------------
### JavaScript: Initialize Google Charts for Report Visualization
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-uitsluiting-kiesrecht-gba.html
This JavaScript snippet loads the Google Visualization library and sets up callbacks to draw charts for 'Features' and 'Scenarios' results upon page load. It configures the chart data with counts for passed, failed, and other statuses, preparing the visualization of test report summaries.
```JavaScript
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(function () { drawChart({ "title": "Features", "failed": 0, "passed": 1, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
google.setOnLoadCallback(function () { drawChart({ "title": "Scenarios", "failed": 0, "passed": 20, "rerun": 0, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
```
--------------------------------
### Render BRP Field Selection UI with JavaScript
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/v2/fields.html
This function takes the response object name and a list of fields to dynamically create the field selection user interface. It initializes an unordered list (``) with the ID 'fields-tree' and then iteratively calls `addTreeItem` to populate it. Finally, it calls `hideUselessToggleButtons` to refine the UI.
```javascript
function renderFieldSelectors(responseObjectName, fieldsList) {
// maak de lijst met velden inclusief checkboxes
fieldsList.shift(); // kolomkop overslaan
var selectors = document.getElementById("selectors");
selectors.innerHTML = '';
addTreeItem(fieldsList);
hideUselessToggleButtons();
}
```
--------------------------------
### Initialize Google Charts and Draw Cucumber Results
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-overlijden-gba.html
Initializes Google Visualization API for the 'corechart' package and sets up callbacks to draw pie charts for 'Features' and 'Scenarios' based on Cucumber test results. This code is typically used in test reports to visualize pass/fail rates.
```JavaScript
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(function () { drawChart({ "title": "Features", "failed": 0, "passed": 3, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
google.setOnLoadCallback(function () { drawChart({ "title": "Scenarios", "failed": 0, "passed": 24, "rerun": 0, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) });
function drawChart(chartData) {
let data = google.visualization.arrayToDataTable([
['Task', 'Cucumber Results'],
['Passed', chartData.passed],
['Failed', chartData.failed],
['Pending', chartData.pending],
['Undefined', chartData.notdefined],
['Ambiguous', chartData.ambiguous],
['Skipped', chartData.skipped],
['Re-run', chartData.rerun]
]);
let total = chartData.passed + chartData.failed + (chartData.pending || 0) + (chartData.notdefined || 0) + (chartData.ambiguous || 0) + (chartData.skipped || 0) || chartData.rerun || 0;
let title;
if (total === 1) {
title = total + ' ' + chartData.title.slice(0, -1);
} else {
title = total + ' ' + chartData.title;
}
let options = {
width: '100%',
height: 240,
title: title,
is3D: true,
colors: ['#5cb85c', '#d9534f', '#999', '#5bc0de', '#428bca', '#f0ad4e', '#ff9933'],
fontSize: '13',
fontName: '"Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif',
slices: {
1: { offset: 0.4 },
2: { offset: 0.4 },
3: { offset: 0.4 },
4: { offset: 0.4 },
5: { offset: 0.4 },
6: { offset: 0.4 },
7: { offset: 0.4 }
},
titleTextStyle: {
fontSize: '13',
color: '#5e5e5e'
}
};
let chart = new google.visualization.PieChart(document.getElementById('piechart_' + chartData.title.toLowerCase()));
chart.draw(data, options);
}
```
--------------------------------
### Format Report Generation Timestamp
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/features/test-report-persoon-leeftijd-gba.html
Locates the element displaying the report generation timestamp, formats it to a human-readable 'time ago' string using Moment.js, and sets the full ISO string as a tooltip. This provides user-friendly time information.
```JavaScript
$(document).ready(function () {
let $generated = $('.generated-on');
let timestamp = $generated.text();
$generated.text('Report generated ' + moment(timestamp).fromNow());
$generated.prop('title', new Date(timestamp).toISOString());
});
```
--------------------------------
### JavaScript Utilities for Report Visualization and UI Interaction
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/features/test-report-persoon-europees-kiesrecht.html
This JavaScript code provides functionalities for loading Google Charts to visualize test results (features and scenarios), handling UI collapse/expand actions using jQuery, formatting report generation timestamps, and toggling screenshot visibility.
```JavaScript
google.load("visualization", "1", { packages: ["corechart"] }); google.setOnLoadCallback(function () { drawChart({ "title": "Features", "failed": 0, "passed": 2, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) }); google.setOnLoadCallback(function () { drawChart({ "title": "Scenarios", "failed": 0, "passed": 30, "rerun": 0, "notdefined": 0, "pending": 0, "skipped": 0, "ambiguous": 0 }) }); $(document).ready(function () {
$('.collapse')
.on('hide.bs.collapse', function (e) {
e.stopPropagation();
$(this).prev().removeClass('open');
})
.on('show.bs.collapse', function (e) {
e.stopPropagation();
$(this).prev().addClass('open');
});
let $generated = $('.generated-on');
let timestamp = $generated.text();
$generated.text('Report generated ' + moment(timestamp).fromNow());
$generated.prop('title', new Date(timestamp).toISOString());
}); $(document).ready(function () {
const $collapsibleItems = $('[data-toggle="collapse"]');
const $collapseAllBtn = $('#collapse_all');
const $expandAllBtn = $('#expand_all');
const collapseAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('hide');
});
};
const expandAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('show');
});
};
$collapseAllBtn.on('click', collapseAll);
$expandAllBtn.on('click', expandAll);
}); function toggle(className) {
let x = $(className);
if (x.css('display') === 'none') {
x.css('display', 'block');
} else {
x.css('display', 'none');
}
} function drawChart(chartData) {
let data = google.visualization.arrayToDataTable([
['Task', 'Cucumber Results'],
['Passed', chartData.passed],
['Failed', chartData.failed],
['Pending', chartData.pending],
['Undefined', chartData.notdefined],
['Ambiguous', chartData.ambiguous],
['Skipped', chartData.skipped],
['Re-run', chartData.rerun],
]);
let total = chartData.passed + chartData.failed + (chartData.pending || 0) + (chartData.notdefined || 0) + (chartData.ambiguous || 0) + (chartData.skipped || 0) || chartData.rerun || 0;
let title;
if (total === 1) {
title = total + ' ' + chartData.title.slice(0, -1);
} else {
title = total + ' ' + chartData.title;
}
let options = {
width: '100%',
height: 240,
title: title,
is3D: true,
colors: ['#5cb85c', '#d9534f', '#999', '#5bc0de', '#428bca', '#f0ad4e', '#ff9933'],
fontSize: '13',
fontName: '"Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif',
slices: {
1: { offset: 0.4 },
2: { offset: 0.4 },
3: { offset: 0.4 },
4: { offset: 0.4 },
5: { offset: 0.4 },
6: { offset: 0.4 },
7: { offset: 0.4 },
},
titleTextStyle: {
fontSize: '13',
color: '#5e5e5e',
},
};
let chart = new google.visualization.PieChart(document.getElementById('piechart_' + chartData.title.toLowerCase()));
chart.draw(data, options);
} $('a.toggle').on('click', function (e) {
e.preventDefault();
if (!$(this).hasClass('collapse')) {
if ($(this).text() === 'Screenshot -') {
// $(this).text('Screenshot +');
$(this).next('a.screenshot').find('img').hide();
} else if ($(this).text() === 'Screenshot +') {
// $(this).text('Screenshot -');
$(this).next('a.screenshot').find('img').show();
}
}
if ($(this).text().includes(' -')) {
$(this).text($(this).text().replace(' -', ' +'));
} else {
$(this).text($(this).text().replace(' +', ' -'));
}
});
```
--------------------------------
### Implement Collapse and Expand All Buttons
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/features/test-report-persoon-gezagsverhouding.html
This script adds functionality to 'collapse all' and 'expand all' buttons. It iterates through all elements with data-toggle="collapse" and triggers their collapse or show events, providing a convenient way to manage the visibility of multiple collapsible sections.
```javascript
$(document).ready(function () {
const $collapsibleItems = $('[data-toggle="collapse"]');
const $collapseAllBtn = $('#collapse_all');
const $expandAllBtn = $('#expand_all');
const collapseAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('hide');
});
};
const expandAll = function () {
$collapsibleItems.each(function () {
$($(this).attr('href')).collapse('show');
});
};
$collapseAllBtn.on('click', collapseAll);
$expandAllBtn.on('click', expandAll);
});
```
--------------------------------
### Handle Bootstrap Collapse/Expand Events
Source: https://github.com/brp-api/haal-centraal-brp-bevragen/blob/master/docs/pr-preview/pr-1894/features/test-report-persoon-leeftijd-gba.html
Attaches event listeners to Bootstrap collapse elements to manage their 'open' class on the previous sibling element when they are shown or hidden. This ensures visual consistency for collapsible sections.
```JavaScript
$(document).ready(function () {
$('.collapse')
.on('hide.bs.collapse', function (e) {
e.stopPropagation();
$(this).prev().removeClass('open');
})
.on('show.bs.collapse', function (e) {
e.stopPropagation();
$(this).prev().addClass('open');
});
});
```