os2web/os2web_datalookup

Provides integration with Danish data lookup services such as Service platformen or Datafordeler.

Installs: 10 239

Dependents: 4

Suggesters: 0

Security: 0

Stars: 0

Watchers: 11

Forks: 1

Open Issues: 3

Type:drupal-module

2.0.1 2024-11-22 09:04 UTC

README

Install

OS2Web Data lookup provides integration with Danish data lookup services such as Service platformen or Datafordeler. Module is available to download via composer.

composer require os2web/os2web_datalookup
drush en os2web_datalookup

Update

Updating process for OS2Web Data lookup module is similar to the usual Drupal 8 module. Use Composer's built-in command for listing packages that have updates available:

composer outdated os2web/os2web_datalookup

Automated testing and code quality

See OS2Web testing and CI information

Contribution

Project is opened for new features and os course bugfixes. If you have any suggestion, or you found a bug in project, you are very welcome to create an issue in GitHub repository issue tracker. For issue description, there is expected that you will provide clear and sufficient information about your feature request or bug report.

Code review policy

See OS2Web code review policy

Git name convention

See OS2Web git name convention

Using services in other modules

// CVR lookup
/** @var \Drupal\os2web_datalookup\Plugin\DataLookupManager $pluginManager */
$pluginManager = \Drupal::service('plugin.manager.os2web_datalookup');
/** @var \Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupCompanyInterface $cvrPlugin */
$cvrPlugin = $pluginManager->createDefaultInstanceByGroup('cvr_lookup');

if ($cvrPlugin->isReady()) {
  $cvrResult = $cvrPlugin->lookup($cvr);
}

// CPR lookup.
/** @var \Drupal\os2web_datalookup\Plugin\DataLookupManager $pluginManager */
$pluginManager = \Drupal::service('plugin.manager.os2web_datalookup');
/** @var \Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupCprInterface $cprPlugin */
$cprPlugin = $pluginManager->createDefaultInstanceByGroup('cpr_lookup');

if ($cprPlugin->isReady()) {
  $cprResult = $cprPlugin->lookup($cpr);
}

// CVR lookup - DEPRECATED.
\Drupal::service('plugin.manager.os2web_datalookup')->createInstance('serviceplatformen_cvr')->getLegalUnit('[CVR number]')


// CPP lookup - DEPRECATED.
\Drupal::service('plugin.manager.os2web_datalookup')->createInstance('serviceplatformen_cpr')->cprBasicInformation('[CPR number]'))

New services/features

Datafordeler integration (https://datafordeler.dk)

In the scope of os2forms project already implemented light integration with Danmarks Adresseregister (DAR) via fetching data for form elements autocomplete.

See os2forms_dawa submodule

As soon as it is clear how the integration is going to be used, then os2forms_dawa will be refactored to OS2Web Data lookup plugin.

Important notes

Serviceplatformen plugins

Settings for CPR and CVR serviceplatformen plugins are storing as configuration in db and will(could) be exported as yml file via Drupal's configuration management system. And afterward could be tracked by git.

If case you have public access to your git repository, all settings from plugins will be exposed for third persons.

To avoid/prevent this behavior, we recommend use Config ignore module, where you can add all settings you do not want to export/import via the configuration management system.