feat: enhance doctor import process with source profile ID for improved idempotency and deduplication
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Doctor\Service;
|
||||
|
||||
/**
|
||||
* استخراج شناسهٔ پایدارِ پروفایل مبدأ از `source_ref`/`profile_url`.
|
||||
*
|
||||
* برای irimc، URL به شکل `.../member/profile?id=<uuid>` است؛ خودِ URL ممکن است
|
||||
* قالبش (دامنه/پارامتر اضافه) تغییر کند، ولی UUID پروفایل ثابت و authoritative است
|
||||
* و کلید اصلی idempotency ایمپورت را میسازد.
|
||||
*/
|
||||
final class SourceProfileId
|
||||
{
|
||||
/** UUID داخل query param `id=`؛ قالب ناشناخته → null (fallback روی medical_system_code). */
|
||||
public static function fromRef(?string $ref): ?string
|
||||
{
|
||||
if ($ref === null || trim($ref) === '') {
|
||||
return null;
|
||||
}
|
||||
if (preg_match('/[?&]id=([0-9a-f-]{8,})/i', $ref, $m) === 1) {
|
||||
return strtolower($m[1]);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user