Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CleaningServiceDummy: Create Dummy Cleaning Result #433

Closed
5 tasks done
nicoprow opened this issue Sep 1, 2023 · 8 comments
Closed
5 tasks done

CleaningServiceDummy: Create Dummy Cleaning Result #433

nicoprow opened this issue Sep 1, 2023 · 8 comments
Assignees
Labels
enhancement New feature or request golden record Issues relating to the Golden Record process

Comments

@nicoprow
Copy link
Contributor

nicoprow commented Sep 1, 2023

Lacking a service provider who can perform cleaning of business partner records we need a simple dummy logic mocking the generic cleaning process while still providing usable cleaning results for the next steps in the orchestration.

One of the biggest tasks in this issue is to create legal entity, site and address representations from the given generic business partner data. The service logic behaviour is dependent on the postal address type:

For creating a legal entity representation:

  • Overtake the legal entity specific fields in the generic business partner
  • Create the legal address as described in creating address representation
  • If the generic business partner has a BPNL assign the legal entity the same BPNL
  • If the generic business partner has no BPNL assign a new BPN request id as the legal entity's BPNL

For creating a site representation:

  • Only create a site representation if the generic business business partner has a BPNS or if the postal address is either LegalAndSiteMainAddress or SiteMainAddress
  • Overtake the name generic business partner
  • Create the site main address as described in creating address representation
  • If the generic business partner has a BPNS assign the site the same BPNS
  • If the generic business partner has no BPNS assign a new BPN request id as the site's BPNS

For creating an address representation:

  • Overtake the name, identifiers and postal address of the generic business partner
  • If the generic business partner has a BPNA assign the address the same BPNA
  • If the generic business partner has no BPNA assign a new BPN request id as the addresse's BPNA

Legal Address, Site Main Address and Address Partner may share a newly BPN request id based on the address type of the generic business partner:

  • LegalAndSiteMainAddress: Same BPN request id for all three addresses
  • LegalAddress: Same BPN request id for Legal Address and Address Partner
  • SiteMainAddress: Same BPN request id for Site Main Address and Address Partner
  • AdditionalAddress: All addresses have different BPN request ids

The field value for 'hasChanged' of the L/S/A partners is always true.

The BPN request identifier is a random UUID.

###Tasks

Dependencies:
#388
#392

@nicoprow
Copy link
Contributor Author

Cleaning Service Dummy can be dumbed down a little bit more: Just don't access the Pool to get actual data and always convert the current generic business partner to its L/S/A representations.

@nicoprow nicoprow added CleaningServiceDummy enhancement New feature or request golden record Issues relating to the Golden Record process labels Sep 13, 2023
@nicoprow nicoprow moved this to 🆕 New in BPDM Kanban Sep 14, 2023
@nicoprow
Copy link
Contributor Author

I simplified the logic for creating dummy cleaning results a bit. Now, legal entities and address representations are always created. The Pool needs to understand this logic and update/create business partners accordingly.

@martinfkaeser martinfkaeser moved this from 🆕 New to 📋 Backlog in BPDM Kanban Sep 20, 2023
@martinfkaeser
Copy link
Contributor

How are the identifiers (and states) from the generic BP split between legalEntity and legalEntity.legalAddress?
If all identifiers were copied to both of them, the Pool might reject them if the identifier type is only valid for either LE or A.

@nicoprow
Copy link
Contributor Author

How are the identifiers (and states) from the generic BP split between legalEntity and legalEntity.legalAddress? If all identifiers were copied to both of them, the Pool might reject them if the identifier type is only valid for either LE or A.

Good question... to be honest to keep it simple I think we can only do this in a limited manner for this cleaningServiceDummy. I would restrict for the dummy cleanning result that all identifiers go to the legal entity. With this, users would need adhere to that limitation only to share legal entitity identifiers otherwise the process rejects it with a cleaningservicedummy in place.

@nicoprow nicoprow moved this from 📋 Backlog to New in BPDM Kanban Sep 21, 2023
@nicoprow nicoprow moved this from New to 📋 Backlog in BPDM Kanban Sep 22, 2023
@nicoprow nicoprow moved this from 📋 Backlog to 🔖 Ready in BPDM Kanban Sep 28, 2023
@fabiodmota fabiodmota self-assigned this Oct 3, 2023
@fabiodmota fabiodmota moved this from 🔖 Ready to 🏗 In progress in BPDM Kanban Oct 4, 2023
@fabiodmota
Copy link
Contributor

fabiodmota commented Oct 9, 2023

So, I have a service that runs every x minutes with scheduling.
The first call fetches a task from the orchestrator for cleaning.

Doubt: We need to validate whether this is a legal entity address or site, but how can we know to map from generic to the corresponding LSA type? We have the fields bpnA, bpnS, and bpnL, but these may not be filled out.
We also have the AddressType ( comment on top from nico 'The service logic behaviour is dependent on the postal address type' ) field that has some nomenclatures (for example, LegalAndSiteMainAddress); can this field also be empty? And in that case, do we assume one by default? What means do we have to validate what type this generic is?

@nicoprow @martinfkaeser @rainer-exxcellent i think you are the ones most in knowledge to answer this

@nicoprow
Copy link
Contributor Author

nicoprow commented Oct 9, 2023

So, I have a service that runs every x minutes with scheduling. The first call fetches a task from the orchestrator for cleaning.

Doubt: We need to validate whether this is a legal entity address or site, but how can we know to map from generic to the corresponding LSA type? We have the fields bpnA, bpnS, and bpnL, but these may not be filled out. We also have the AddressType ( comment on top from nico 'The service logic behaviour is dependent on the postal address type' ) field that has some nomenclatures (for example, LegalAndSiteMainAddress); can this field also be empty? And in that case, do we assume one by default? What means do we have to validate what type this generic is?

@nicoprow @martinfkaeser @rainer-exxcellent i think you are the ones most in knowledge to answer this

To elaborate the logic in the issue description: Independent of which BPNs or address type is given, we always create a legal entity with legal address and a logistic address from given generic business partner data.

The BPNs and address type only influence what is being written in the BPN reference fields and whether also a site will be created.

@fabiodmota
Copy link
Contributor

fabiodmota commented Oct 11, 2023

After clearing the logic part here is a diagram from mermaid of the logic implemented

graph TD;

    ScheduleProcess(Schedule Process: Scheduled Task) --> Step1(Step 1: Fetch and Reserve Cleaning Request)
    Step1 -->|cleaningTasks| Step2(Step 2: Process Cleaning Tasks)
    
    Step2 --> AddressRepresentation(Create LogisticAddress Representation)
    AddressRepresentation --> CheckBpnA{Does it have BpnA?}
    CheckBpnA -->|Yes| UseExistingBpnA(Use Existing BpnA)
    CheckBpnA -->|No| GenerateBpnA(Generate New BpnA)
    
    UseExistingBpnA --> LegalEntityCreation(Create Legal Entity Representation)
    GenerateBpnA --> LegalEntityCreation(Create Legal Entity Representation)

    LegalEntityCreation --> CheckAddressType{Is Address Type Legal or LegalAndSiteMain?}
   
    CheckAddressType -->|Yes| UseBpnAForLegalAddress(Use BpnA for Legal Address)
    CheckAddressType -->|No| GenerateBpnAForLegalAddress(Generate New BpnA for Legal Address)
    
    UseBpnAForLegalAddress --> CheckBpnL{Does it have BpnL?}
    GenerateBpnAForLegalAddress --> CheckBpnL{Does it have BpnL?}
    CheckBpnL -->|Yes| UseExistingBpnL(Use Existing BpnL)
    CheckBpnL -->|No| GenerateBpnL(Generate New Bpnl)
    UseExistingBpnL--> CreateLegalEntity{Create Legal Entity }
    GenerateBpnL--> CreateLegalEntity(Finished Legal Entity creation)

    CreateLegalEntity --> SiteCreation{Should Create Site?}
    SiteCreation -->|Yes| CheckSiteConditions{SiteMainAddress, LegalAndSiteMainAddress, or BpnS?}
    SiteCreation -->|No| AddressCreation

    CheckSiteConditions -->|Yes| UseBpnAForSiteAddress(Use BpnA for Site Address)
    CheckSiteConditions -->|No| GenerateBpnAForSite(Generate New BpnA for Site)
    
    CheckBpnS{Does it have BpnS?}
    CheckBpnS -->|Yes| UseExistingBpnS(Use Existing BpnS)
    CheckBpnS -->|No| GenerateBpnS(Generate New BpnS)
   
    UseBpnAForSiteAddress --> CheckBpnS{Does it have BpnS?}
    GenerateBpnAForSite --> CheckBpnS{Does it have BpnS?}
    UseExistingBpnS--> CreateSite(Finished Site creation)
    GenerateBpnS--> CreateSite(Finished Site creation)
    CreateSite --> AddressCreation(Validate AddressPartner Creation)
    AddressCreation --> CheckAddressConditions{Type is Additional Address?}
    
    CheckAddressConditions -->|Yes| UseLogistic(Use Logistic address as AddressPartner)
    CheckAddressConditions -->|No| Step3
    UseLogistic --> Step3(Step 3: Send Result back to Orchestrator)
Loading
  1. The process begins with the scheduled task, followed by fetching and reserving cleaning tasks.
  2. For each reserved cleaning task, a logistic address representation is created to be used.
  3. The presence of BpnA is checked and accordingly, either an existing BpnA is used or a new one is generated.
  4. A legal entity representation is then created.
  5. Based on the address type, either the existing BpnA is used for the legal address or a new one is generated.
  6. The presence of BpnL is checked and accordingly, either an existing BpnL is used or a new one is generated.
  7. The legal entity creation process is finalized.
  8. A decision is made regarding the creation of the site based on certain conditions.
  9. If a site needs to be created, the BpnS check and creation process is initiated.
  10. The site creation process is finalized.
  11. Address validation is done based on the address type.
  12. Finally, the results are sent back to the orchestrator.

@fabiodmota fabiodmota moved this from 🏗 In progress to 👀 In review in BPDM Kanban Oct 16, 2023
@fabiodmota
Copy link
Contributor

PR merged we can close the issue @nicoprow

@nicoprow nicoprow moved this from 👀 In review to ✅ Done in BPDM Kanban Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request golden record Issues relating to the Golden Record process
Projects
Archived in project
Development

No branches or pull requests

3 participants