Netherlands - Generic Functions for data exchange Implementation Guide
0.1.0 - ci-build Netherlands flag

Netherlands - Generic Functions for data exchange Implementation Guide - Local Development build (v0.1.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

StructureMap: KVK Vestigingsprofiel naar FHIR Location

Official URL: http://minvws.github.io/generiekefuncties-docs/StructureMap/KvkVestigingsprofielToLocation Version: 0.1.0
Draft as of 2026-03-05 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/kvk-vestigingsprofiel" 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/ura' "assignerIdSystem";
        vestNr -> assignerId.value = '00000001' "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 = 'author' "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 = straat as addrLine then {
    straat -> addrLine.extension as ext then {
      straat -> ext.url = 'http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-streetName' "streetNameExtUrl";
      straat -> ext.valueString = 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.valueString = cast(huisnr, 'string') "houseNumberExtValue";
    } "houseNumberExt";
  };
  src.huisletter as huisltr -> tgt.line = huisltr as addrLine3 then {
    huisltr -> addrLine3.extension as ext then {
      huisltr -> ext.url = 'http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-buildingNumberSuffix' "houseLetterExtUrl";
      huisltr -> ext.valueString = huisltr "houseLetterExtValue";
    } "houseLetterExt";
  };
  src.huisnummerToevoeging as huisnrToev -> tgt.line = huisnrToev as addrLine4 then {
    huisnrToev -> addrLine4.extension as ext then {
      huisnrToev -> ext.url = 'http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-buildingNumberSuffix' "houseNumberAdditionExtUrl";
      huisnrToev -> ext.valueString = 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 : Location.position) {
  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-2025-cs' "sbiSystem";
    src.sbiCode as code -> coding.code = code;
    src.sbiOmschrijving as omschr -> coding.display = omschr "sbiDisplay";
  } "sbiCoding";
}