Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Lucidchart link

...

owners positions should be one of the list - env. configuration OWNER_POSITIONS.

At the moment it is - "P1, P2, P3, P32, P4, P6, P5, P18, P19, P22, P23, P24, P25, P26, P229, P230, P231, P232, P233, P234, P235, P236, P240"

At the moment it is - "P1, P2, P3, P32, P4, P6, P5, P18, P19, P22, P23, P24, P25, P26, P229, P230, P231, P232, P233, P234, P235, P236, P240, P257"

Anchor
EDRValidation
EDRValidation
EDR Validation

...

  1. Change the record according to received request
    1. Some of the fields must not be changed. This fields must be excluded from PATCH request: EDRPOU, TYPE 
    2. set accreditations = Request: $.medical_services_providers.accreditations
    3. save residence address into legal_entities.residence_address
  2. If nhs_reviewed = true reset it to false

...

  1. Search for a record in prm.licenses for current legal entity  
    1. Check if any attribute has changed comparing request and prm data. If yes, then:
      1. For each record in prm.legal_entities related to the license:
        1. If nhs_reviewed = true reset it to false
        2. If nhs_verified = true
          1. reset it to false
          2. set `nhs_unverified_at`  to current date
    2. Update license data according to the request

See Service specification

Update LE official name

Extract official name from Digital signature. 

  • Update `legal_entities.public_name` in prm with official name from Digital signature
  • Update `clients.name` in mithril with official name from Digital signature 

Update Contract Request

  1. Find contract requests related to current legal entity in status = NEW, APPROVED, PENDING_NHS_SIGN, NHS_SIGNED, set status = 'TERMINATED', status_reason "Legal Entity Data has changed"

Reset flags

Update Contract

In case Legal Entity already exists in DB we need to check whether next fields weren't changed:

...

Compare fields in prm.legal_entities and in request. In case any of the fields above were changed

find contracts by contractor_legal_entity_id=$legal_entities.id  and status='VERIFIED'. Set ops.contracts.is_suspended=true

...

  1. select licenses.id from prm.licenses where type = $.type and id in (select license_id from legal_entities where edr_data_id in (select id from edr_data where edr_id = active edr id))
    1. If record found then
      1. check if any attribute has changed comparing request and prm data. If yes, then:
        1. For each record in prm.legal_entities related to the license:
          1. If nhs_reviewed = true reset it to false
          2. If nhs_verified = true
            1. reset it to false
            2. set `nhs_unverified_at` to current date
      2. Update license data according to the request
    2. if record not found then create new record:
      1. set 'licenses.type' = MSP if Request: $.type = MSP 
      2. set 'licenses.type' = PHARMACY if Request: $.type = PHARMACY
      3. set 'licenses.is_active' = true and populate inserted_by, inserted_at, updated_by, updated_at fields
      4. set issued_by, issued_date, expiry_date, active_from_date, what_licensed, order_no according to Request: $.medical_services_providers.licenses data
      5. Link created record and edr_data record 

...

  1. Create new record according to received request 
    1. Link created record and edr_data record
    2. Link created record and license 
    3. set accreditations = Request: $.medical_services_providers.accreditations
    4. save registration_address separately
    5. set nhs_verified, nhs_reviewed to false
    6. set `nhs_unverified_at` to current date
    7. set status = active suspended

See Service specification

Save LE official name

Extract official name from Digital signature. 

  • Save LE official name to prm DB = legal_entities.public_name 
  • Save LE official name to mithril DB = clients.name 

...