Netherlands - Generic Functions for data exchange Implementation Guide
0.2.0-ballot - ci-build

Netherlands - Generic Functions for data exchange Implementation Guide, published by Ministerie van Volksgezondheid, Welzijn en Sport. This guide is not an authorized publication; it is the continuous build for version 0.2.0-ballot built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/minvws/generiekefuncties-docs/ and changes regularly. See the Directory of published versions

## StructureMap: KVK Vestigingsprofiel naar FHIR Location

Official URL: http://minvws.github.io/generiekefuncties-docs/StructureMap/KvkVestigingsprofielToLocation | Version: 0.2.0-ballot
Draft as of 2026-03-12 | Computable Name: KvkVestigingsprofielToLocation

StructureMap die een KVK Vestigingsprofiel API response transformeert naar een FHIR Location resource.

    map "http://minvws.github.io/generiekefuncties-docs/StructureMap/KvkVestigingsprofielToLocation" = "KvkVestigingsprofielToLocation"

    // StructureMap die een KVK Vestigingsprofiel API response transformeert naar een FHIR Location resource.

    uses "http://minvws.github.io/generiekefuncties-docs/StructureDefinition/KvkVestigingsprofiel" alias KvkVestigingsprofiel as source
    uses "http://minvws.github.io/generiekefuncties-docs/StructureDefinition/nl-gf-location" alias NlGfLocation as target

    group KvkVestigingsprofielToLocation(source src : KvkVestigingsprofiel, target tgt : Location) {
      src -> tgt.meta as meta then {
        src -> meta.profile = 'http://minvws.github.io/generiekefuncties-docs/StructureDefinition/nl-gf-location' "setProfileUrl";
      } "setProfile";
      src.vestigingsnummer as vestNr -> tgt.identifier as vestId then {
        vestNr -> vestId.use = 'official' "vestUse";
        vestNr -> vestId.system = 'http://fhir.nl/fhir/NamingSystem/kvk-vestigingsnummer' "vestSystem";
        vestNr -> vestId.value = vestNr "vestValue";
        vestNr -> vestId.assigner as assignerRef then {
          vestNr -> assignerRef.identifier as assignerId then {
            vestNr -> assignerId.system = 'http://fhir.nl/fhir/NamingSystem/kvk' "assignerIdSystem";
            vestNr -> assignerId.value = '50000535' "assignerIdValue";
            vestNr -> assignerId.type as assignerIdType then {
              vestNr -> assignerIdType.coding as assignerIdTypeCoding then {
                vestNr -> assignerIdTypeCoding.system = 'http://terminology.hl7.org/CodeSystem/provenance-participant-type' "assignerIdTypeCodingSystem";
                vestNr -> assignerIdTypeCoding.code = 'custodian' "assignerIdTypeCodingCode";
              } "assignerIdTypeCoding";
            } "assignerIdType";
          } "assignerIdentifier";
        } "vestAssigner";
      };
      src.kvkNummer as kvkNum -> tgt.managingOrganization as orgRef then {
        kvkNum -> orgRef.identifier as orgId then {
          kvkNum -> orgId.system = 'http://fhir.nl/fhir/NamingSystem/kvk' "orgIdSystem";
          kvkNum -> orgId.value = kvkNum "orgIdValue";
        } "orgRefIdentifier";
        kvkNum -> orgRef.type = 'Organization' "orgRefType";
        kvkNum -> orgRef.reference = append('Organization/', kvkNum) "orgRefReference";
      };
      src.eersteHandelsnaam as naam -> tgt.name = naam;
      src -> tgt.status = 'active' "setStatus";
      src -> tgt.mode = 'instance' "setMode";
      src.statutaireNaam as statNaam -> tgt.alias = statNaam;
      src.handelsnamen as hn then KvkVestHandelsnaamToAlias(hn, tgt);
      src.adressen as adres -> tgt.address as addr then KvkVestAdresToAddress(adres, addr);
      src.adressen as adres then {
        adres.geoData as geo -> tgt.position as pos then KvkGeoDataToPosition(geo, pos) "geoDataToPosition";
      } "geoData";
      src.websites as web -> tgt.telecom as tel then KvkVestWebsiteToContactPoint(web, tel);
      src.sbiActiviteiten as sbi -> tgt.type as cc then KvkVestSBIToCodeableConcept(sbi, cc);
    }

    group KvkVestHandelsnaamToAlias(source src, target tgt : Location) {
      src.naam as naam -> tgt.alias = naam;
    }

    group KvkVestAdresToAddress(source src, target tgt : Address) {
      src.volledigAdres as volledigAdres -> tgt.text = volledigAdres;
      src.straatnaam as straat -> tgt.line = cast(straat, 'string') as addrLine then {
        straat -> addrLine.extension as ext then {
          straat -> ext.url = 'http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-streetName' "streetNameExtUrl";
          straat -> ext.value = straat "streetNameExtValue";
        } "streetNameExt";
      };
      src.huisnummer as huisnr -> tgt.line = cast(huisnr, 'string') as addrLine2 then {
        huisnr -> addrLine2.extension as ext then {
          huisnr -> ext.url = 'http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-houseNumber' "houseNumberExtUrl";
          huisnr -> ext.value = cast(huisnr, 'string') "houseNumberExtValue";
        } "houseNumberExt";
      };
      src.huisletter as huisltr -> tgt.line = cast(huisltr, 'string') as addrLine3 then {
        huisltr -> addrLine3.extension as ext then {
          huisltr -> ext.url = 'http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-buildingNumberSuffix' "houseLetterExtUrl";
          huisltr -> ext.value = huisltr "houseLetterExtValue";
        } "houseLetterExt";
      };
      src.huisnummerToevoeging as huisnrToev -> tgt.line = cast(huisnrToev, 'string') as addrLine4 then {
        huisnrToev -> addrLine4.extension as ext then {
          huisnrToev -> ext.url = 'http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-additionalLocator' "houseNumberAdditionExtUrl";
          huisnrToev -> ext.value = huisnrToev "houseNumberAdditionExtValue";
        } "houseNumberAdditionExt";
      };
      src.postcode as pc -> tgt.postalCode = pc;
      src.plaats as plaats -> tgt.city = plaats;
      src.regio as regio -> tgt.district = regio;
      src.land as land -> tgt.country = land;
      src -> tgt.use = 'work' "setUse";
    }

    group KvkGeoDataToPosition(source src, target tgt) {
      src.gpsLatitude as lat -> tgt.latitude = lat "latitude";
      src.gpsLongitude as lon -> tgt.longitude = lon "longitude";
    }

    group KvkVestWebsiteToContactPoint(source src, target tgt : ContactPoint) {
      src -> tgt.system = 'url' "setSystem";
      src as url -> tgt.value = url "setValue";
      src -> tgt.use = 'work' "setUse";
    }

    group KvkVestSBIToCodeableConcept(source src, target tgt : CodeableConcept) {
      src -> tgt.coding as coding then {
        src -> coding.system = 'http://minvws.github.io/generiekefuncties-docs/CodeSystem/nl-gf-sbi-cs' "sbiSystem";
        src.sbiCode as code -> coding.code = code;
        src.sbiOmschrijving as omschr -> coding.display = omschr "sbiDisplay";
      } "sbiCoding";
    }