Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Added G2PConnect Importer Module
Browse files Browse the repository at this point in the history
Signed-off-by: mkumar-02 <[email protected]>
  • Loading branch information
mkumar-02 committed Jun 9, 2024
1 parent 367918f commit 989f93e
Show file tree
Hide file tree
Showing 21 changed files with 1,299 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!-- /!\ Non OCA Context : Set here the badge of your runbot / runboat instance. -->
[![Pre-commit Status](https://github.com/OpenG2P/openg2p-importer/actions/workflows/pre-commit.yml/badge.svg?branch=15.0-develop)](https://github.com/OpenG2P/openg2p-importer/actions/workflows/pre-commit.yml?query=branch%3A15.0-develop)
[![Build Status](https://github.com/OpenG2P/openg2p-importer/actions/workflows/test.yml/badge.svg?branch=15.0-develop)](https://github.com/OpenG2P/openg2p-importer/actions/workflows/test.yml?query=branch%3A15.0-develop)
[![codecov](https://codecov.io/gh/OpenG2P/openg2p-importer/branch/15.0-develop/graph/badge.svg)](https://codecov.io/gh/OpenG2P/openg2p-importer)
[![Pre-commit Status](https://github.com/OpenG2P/openg2p-importers/actions/workflows/pre-commit.yml/badge.svg?branch=15.0-develop)](https://github.com/OpenG2P/openg2p-importers/actions/workflows/pre-commit.yml?query=branch%3A15.0-develop)
[![Build Status](https://github.com/OpenG2P/openg2p-importers/actions/workflows/test.yml/badge.svg?branch=15.0-develop)](https://github.com/OpenG2P/openg2p-importers/actions/workflows/test.yml?query=branch%3A15.0-develop)
[![codecov](https://codecov.io/gh/OpenG2P/openg2p-importers/branch/15.0-develop/graph/badge.svg)](https://codecov.io/gh/OpenG2P/openg2p-importers)
<!-- /!\ Non OCA Context : Set here the badge of your translation instance. -->

<!-- /!\ do not modify above this line -->

# openg2p-importers
# OpenG2P Importers

Repository for all importers in OpenG2P

Expand All @@ -22,6 +22,7 @@ addon | version | maintainers | summary
--- | --- | --- | ---
[g2p_mis_importer](g2p_mis_importer/) | 15.0.1.2.0 | | G2P MIS Importer
[g2p_odk_importer](g2p_odk_importer/) | 15.0.1.2.0 | | Import records from ODK
[g2p_social_registry_importer](g2p_social_reigstry_importer/) | 15.0.1.0.0 | | Import records from Social Registry

[//]: # (end addons)

Expand Down
57 changes: 57 additions & 0 deletions g2p_social_registry_importer/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
================================
OpenG2P Social Registry Importer
================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b33dbddef64baabd6fefe0ff59dca3cad6aedc06a140b4106270a205258f0703
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/github-OpenG2P%2Fopeng2p--importers-lightgray.png?logo=github
:target: https://github.com/OpenG2P/openg2p-importers/tree/15.0-develop/g2p_social_registry_importer
:alt: OpenG2P/openg2p-importers

|badge1| |badge2|

G2P Social Registry Importer

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OpenG2P/openg2p-importers/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OpenG2P/openg2p-importers/issues/new?body=module:%20g2p_social_registry_importer%0Aversion:%2015.0-develop%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* OpenG2P

Maintainers
~~~~~~~~~~~

This module is part of the `OpenG2P/openg2p-importers <https://github.com/OpenG2P/openg2p-importers/tree/15.0-develop/g2p_social_registry_importer>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions g2p_social_registry_importer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
29 changes: 29 additions & 0 deletions g2p_social_registry_importer/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Part of openG2P. See LICENSE file for full copyright and licensing details.

{
"name": "OpenG2P Social Registry Importer",
"category": "G2P",
"summary": "Import records from Social Registry",
"version": "15.0.1.1.0",
"author": "OpenG2P",
"development_status": "Alpha",
"website": "https://github.com/OpenG2P/openg2p-auth",
"license": "Other OSI approved licence",
"depends": [
"g2p_programs",
"g2p_registry_membership",
"spp_registry_data_source",
],
"data": [
"data/ir_config_params.xml",
"data/social_registry_data_source.xml",
"data/search_criteria.xml",
# "security/groups.xml",
"security/ir.model.access.csv",
"views/fetch_social_registry_beneficiary_views.xml",
],
"external_dependencies": {"python": ["camel_converter"]},
"application": True,
"auto_install": False,
"installable": True,
}
23 changes: 23 additions & 0 deletions g2p_social_registry_importer/data/ir_config_params.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<function
model="ir.config_parameter"
name="set_param"
eval="('g2p_import_social_registry.client_id', 'openg2p-admin-client')"
/>
<function
model="ir.config_parameter"
name="set_param"
eval="('g2p_import_social_registry.client_password', '')"
/>
<function
model="ir.config_parameter"
name="set_param"
eval="('g2p_import_social_registry.grant_type', 'client_credentials')"
/>
<function
model="ir.config_parameter"
name="set_param"
eval="('g2p_import_social_registry.max_registrants_count_job_queue', 100)"
/>
</odoo>
64 changes: 64 additions & 0 deletions g2p_social_registry_importer/data/search_criteria.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="g2p_fetch_sr_data" model="g2p.fetch.social.registry.beneficiary">
<field name="name">Fetch Social Registry Data</field>
<field name="data_source_id" ref="g2p_social_registry_importer.g2p_social_registry_data_source" />
<field name="import_registrant_without_id">False</field>
<field name="target_registry">individual</field>
<field name="target_program" />
<field name="query">
{
getRegistrants(isGroup: true, limit:2){
name,
isGroup,
givenName,
familyName,
groupMembershipIds{
individual{
name,
gender,
givenName,
familyName,
addlName,
email,
gender,
address,
registrationDate,
birthPlace,
birthdate,
createDate,
writeDate,
regIds{
idTypeAsStr,
value,
expiryDate
},
phoneNumberIds{
phoneNo,
phoneSanitized,
dateCollected,
disabled
}
},
kind{
name
},
createDate,
writeDate
},
phoneNumberIds{
phoneNo,
phoneSanitized,
dateCollected,
disabled
},
regIds{
idTypeAsStr,
value,
expiryDate
}
}
}
</field>
</record>
</odoo>
24 changes: 24 additions & 0 deletions g2p_social_registry_importer/data/social_registry_data_source.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="g2p_social_registry_data_source" model="spp.data.source">
<field name="name">Social Registry</field>
<field name="url">http://social-registry-odoo.social-registry/api/v1/g2p-connect</field>
<field name="auth_type">bearer_authentication</field>
</record>
<record id="g2p_social_registry_oauth2_path" model="spp.data.source.path">
<field
name="data_source_id"
eval="ref('g2p_social_registry_importer.g2p_social_registry_data_source')"
/>
<field name="key">Authentication</field>
<field name="value">http://keycloak.keycloak/realms/openg2p/protocol/openid-connect/token</field>
</record>
<record id="g2p_social_registry_registry_path" model="spp.data.source.path">
<field
name="data_source_id"
eval="ref('g2p_social_registry_importer.g2p_social_registry_data_source')"
/>
<field name="key">Registry Sync Search</field>
<field name="value">/registry/sync/search</field>
</record>
</odoo>
4 changes: 4 additions & 0 deletions g2p_social_registry_importer/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import constants
from . import fetch_social_registry_beneficiary
from . import imported_registrants
from . import res_partner
7 changes: 7 additions & 0 deletions g2p_social_registry_importer/models/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
GRAPHQL = "graphql"

DATA_SOURCE_NAME = "Social Registry"
DATA_SOURCE_SEARCH_PATH_NAME = "Registry Sync Search"
DATA_SOURCE_AUTH_PATH_NAME = "Authentication"

REQUEST_TIMEOUT = 10
Loading

0 comments on commit 989f93e

Please sign in to comment.