-
Notifications
You must be signed in to change notification settings - Fork 16
Move code from 3.4.0 to main #81
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
Conversation
fix: amm-1668 beneficiary details addition
* fix: changed build version to 3.4.0 * fix: common ui cahanges
WalkthroughUpdates project version and submodule pointer. Adds conditional fields to beneficiary details. Introduces Material Autocomplete for provisional diagnoses across multiple components, replacing prior search inputs. Implements per-row suggestion fetching via MasterdataService, new handlers, and shifts from method-based getters to array getters. Adds translation keys and tweaks an environment template constant. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant C as DiagnosisComponent
participant F as FormArray (provisionalDiagnosisList)
participant M as MasterdataService
rect rgb(240,245,255)
note over U,C: Typing to fetch suggestions (keyup)
U->>C: Type in provisional diagnosis
alt length >= 3
C->>M: fetchDiagnoses(query)
M-->>C: suggestions[]
C->>C: suggestedDiagnosisList[i] = suggestions
else length < 3
C->>C: suggestedDiagnosisList[i] = []
end
end
rect rgb(240,255,240)
note over U,C: Selecting a suggestion
U->>C: Select option
C->>F: Patch group i with { viewProvisionalDiagnosisProvided, conceptID, term }
C->>F: (optional) Disable/mark touched as needed
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (8)
src/assets/Hindi.json (1)
80-104: Add UI bindings for the newlastNamefieldWe’ve confirmed that every locale file (e.g.
src/assets/Hindi.json) includes the new key under its language root (Hindi.bendetails.lastName), but no code or template currently references it. To avoid blank “Last Name” cells, please:
- In
src/app/app-modules/registrar/registration/registration.component.ts, alongside the existing pushes forphoneNo,age,gender, etc., add:required.push(this.currentLanguageSet.bendetails.lastName);- In your beneficiary‐details template (for example,
src/app/app-modules/registrar/registration/register-demographic-details/register-demographic-details.component.html), insert a header and cell binding:<th>{{ currentLanguageSet.bendetails.lastName }}</th> <td>{{ beneficiary.lastName }}</td>Once these are in place, verify in multiple languages to ensure the “Last Name” column renders correctly.
pom.xml (1)
71-72: Property interpolation bug: server-hostname/port won’t resolveThese lines use braces instead of Maven property syntax, resulting in literal strings rather than interpolated values. If used downstream, this will break env-specific packaging.
Apply this diff:
- <server-hostname>{hostname-${environment}}</server-hostname> - <server-port>{port-${environment}}</server-port> + <server-hostname>${hostname-${environment}}</server-hostname> + <server-port>${port-${environment}}</server-port>Optionally, if nested interpolation is undesirable, resolve via profiles instead.
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-screening-diagnosis/ncd-screening-diagnosis.component.html (1)
42-51: Bug: FormArray value used like an object in remove button conditiongeneralDiagnosisForm.get('provisionalDiagnosisList')?.value returns an array, so dereferencing .viewProvisionalDiagnosisProvided causes a runtime error. Use the row control already available via diagnosis.
Fix:
- *ngIf=" - diagnosis.get('viewProvisionalDiagnosisProvided')?.disabled || - i !== 0 || - (i === 0 && - generalDiagnosisForm.get('provisionalDiagnosisList')?.value - .viewProvisionalDiagnosisProvided !== null && - generalDiagnosisForm.get('provisionalDiagnosisList')?.value - .viewProvisionalDiagnosisProvided !== '') - " + *ngIf=" + i !== 0 || + diagnosis.get('viewProvisionalDiagnosisProvided')?.disabled || + !!diagnosis.get('viewProvisionalDiagnosisProvided')?.value + "src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-care-diagnosis/ncd-care-diagnosis.component.ts (1)
164-187: Guard against empty arrays and move addDiagnosis() outside the loopAccessing provisionalDiagnosis[0] without checking length can throw. Also, calling addDiagnosis() inside the loop is harder to reason about; a single call after the loop is clearer and yields one trailing blank row.
Apply:
- console.log('from diagnosis' + provisionalDiagnosis[0].term); - if ( - provisionalDiagnosis[0].term !== '' && - provisionalDiagnosis[0].conceptID !== '' - ) { - console.log('from diagnosis second' + provisionalDiagnosis[0].term); - - for (let i = 0; i < savedDiagnosisData.length; i++) { + if ( + Array.isArray(savedDiagnosisData) && + savedDiagnosisData.length > 0 && + savedDiagnosisData[0].term !== '' && + savedDiagnosisData[0].conceptID !== '' + ) { + for (let i = 0; i < savedDiagnosisData.length; i++) { diagnosisArrayList.at(i).patchValue({ viewProvisionalDiagnosisProvided: savedDiagnosisData[i].term, term: savedDiagnosisData[i].term, conceptID: savedDiagnosisData[i].conceptID, }); (<FormGroup>diagnosisArrayList.at(i)).controls[ 'viewProvisionalDiagnosisProvided' ].disable(); - this.addDiagnosis(); - } + } + // add exactly one empty row at the end for user convenience + this.addDiagnosis(); }src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/general-opd-diagnosis/general-opd-diagnosis.component.ts (1)
183-194: Guard empty array and move addDiagnosis() after loopSame pattern as NCD care: array indexing at [0] without length check and addDiagnosis() inside loop. Recommend guarding and moving add after loop for clarity.
- console.log('from diagnosis' + provisionalDiagnosis[0].term); - if ( - provisionalDiagnosis[0].term !== '' && - provisionalDiagnosis[0].conceptID !== '' - ) { - console.log('from diagnosis second' + provisionalDiagnosis[0].term); - - for (let i = 0; i < savedDiagnosisData.length; i++) { + if ( + Array.isArray(savedDiagnosisData) && + savedDiagnosisData.length > 0 && + savedDiagnosisData[0].term !== '' && + savedDiagnosisData[0].conceptID !== '' + ) { + for (let i = 0; i < savedDiagnosisData.length; i++) { diagnosisArrayList.at(i).patchValue({ viewProvisionalDiagnosisProvided: savedDiagnosisData[i].term, term: savedDiagnosisData[i].term, conceptID: savedDiagnosisData[i].conceptID, }); (<FormGroup>diagnosisArrayList.at(i)).controls[ 'viewProvisionalDiagnosisProvided' ].disable(); - this.addDiagnosis(); - } + } + this.addDiagnosis(); }src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-care-diagnosis/ncd-care-diagnosis.component.html (1)
152-160: Fix incorrect FormArray value access in remove button conditionYou’re reading FormArray.value as if it were a single object. It’s an array, so
.value.viewProvisionalDiagnosisProvidedis always undefined. Use the row’sdiagnosisgroup instead.Apply this diff:
- (i === 0 && - generalDiagnosisForm.get('provisionalDiagnosisList') - ?.value.viewProvisionalDiagnosisProvided !== null && - generalDiagnosisForm.get('provisionalDiagnosisList') - ?.value.viewProvisionalDiagnosisProvided !== '') + (i === 0 && + diagnosis.get('viewProvisionalDiagnosisProvided')?.value !== null && + diagnosis.get('viewProvisionalDiagnosisProvided')?.value !== '')src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/general-opd-diagnosis/general-opd-diagnosis.component.html (2)
41-47: Bug: FormArray accessed as object in remove button conditionSame issue as in NCD care:
provisionalDiagnosisListis a FormArray;.valueis an array, not an object.Apply this diff:
- (i === 0 && - generalDiagnosisForm.get('provisionalDiagnosisList')?.value - .viewProvisionalDiagnosisProvided !== null && - generalDiagnosisForm.get('provisionalDiagnosisList')?.value - .viewProvisionalDiagnosisProvided !== '') + (i === 0 && + diagnosis.get('viewProvisionalDiagnosisProvided')?.value !== null && + diagnosis.get('viewProvisionalDiagnosisProvided')?.value !== '')
72-72: Typo in i18n key “specialistssdvice” – rename to “specialistAdvice”The key “specialistssdvice” is misspelled in all translation files and is used throughout multiple templates. To avoid confusion and align with the form field names (which use “specialistAdvice”), please:
• Update every JSON asset (English.json, Assamese.json, Hindi.json, language.json, etc.):
- "specialistssdvice": "Specialist's Advice" + "specialistAdvice": "Specialist's Advice"• In all templates under src/app/app-modules/nurse-doctor/…, change:
- {{ current_language_set?.DiagnosisDetails?.specialistssdvice }} + {{ current_language_set?.DiagnosisDetails?.specialistAdvice }}• Verify no remaining references to “specialistssdvice” in code or assets.
This renaming will ensure consistency across i18n keys, template bindings, and form controls.
🧹 Nitpick comments (22)
src/assets/English.json (1)
26-49: Minor spelling nitpicks in unchanged keys (optional)Not part of this change, but consider correcting “Martial Status” to “Marital Status” to avoid user-facing typos.
pom.xml (1)
75-133: Optional: frontend build via exec-maven-pluginCurrent approach assumes npm is present on PATH and re-runs npm install at compile. Consider frontend-maven-plugin or caching node_modules in CI to reduce build time.
src/app/app-modules/core/components/beneficiary-details/beneficiary-details.component.html (2)
42-49: Make phone number tap-to-callTurning the displayed phone into a tel: link improves usability on mobile and accessibility.
Apply:
- <td>{{ beneficiary?.preferredPhoneNum }}</td> + <td> + <a [href]="'tel:' + (beneficiary?.preferredPhoneNum || '')"> + {{ beneficiary?.preferredPhoneNum }} + </a> + </td>
22-49: Reduce repeated inline styles (optional)The repeated inline style attributes are consistent with existing code, but consider a CSS class (e.g., .row-header, .row-value) to centralize styling. This keeps templates lighter and avoids micro-diffs.
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-screening-diagnosis/ncd-screening-diagnosis.component.html (1)
26-26: Debounce and clear stale selections on free-typed edits (optional UX/correctness)Calling the service on every keyup can flood backend and produce race conditions; additionally, when users edit text after selecting an option, conceptID/term can remain stale. Consider debouncing and clearing conceptID/term when input diverges from a selected item until a new selection is made.
Happy to propose a small helper to manage per-row Subjects with debounceTime and switchMap if desired.
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/pnc-diagnosis/pnc-diagnosis.component.html (1)
20-29: Prefer input event over keyup and clear stale concept on edits (optional)Using (input) instead of (keyup) reduces event noise and better reflects value changes (incl. pastes). Also consider clearing conceptID/term when the user edits text post-selection to enforce re-selection.
Suggested minimal HTML tweak:
- [matAutocomplete]="autoDiagnosis" (keyup)="onDiagnosisInputKeyup(diagnosisInput.value, i)" /> + [matAutocomplete]="autoDiagnosis" (input)="onDiagnosisInputKeyup(diagnosisInput.value, i)" />And complement in TS by nulling conceptID/term when length < 3 or when text no longer matches the selection.
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-care-diagnosis/ncd-care-diagnosis.component.ts (4)
272-282: Debounce/cancel suggestion queries and clear stale selection on short inputsDirect subscription per key press can cause race conditions and unnecessary traffic. Additionally, when input length drops below 3, clear conceptID/term to avoid stale selections.
Minimal correctness patch within current approach:
if (value.length >= 3) { this.masterdataService .searchDiagnosisBasedOnPageNo(value, index) .subscribe((results: any) => { this.suggestedDiagnosisList[index] = results?.data?.sctMaster; }); } else { - this.suggestedDiagnosisList[index] = []; + this.suggestedDiagnosisList[index] = []; + const arr = this.generalDiagnosisForm.get('provisionalDiagnosisList') as FormArray; + const group = arr.at(index) as FormGroup; + group.patchValue({ conceptID: null, term: null }); }If you want, I can propose a RxJS-based debounced solution that also cancels in-flight requests.
288-301: onDiagnosisSelected patch is correct; ensure trailing comma style for PrettierLogic is sound. To satisfy strict trailing-comma configs, keep a trailing comma in multiline object literals.
diagnosisFormGroup.patchValue({ viewProvisionalDiagnosisProvided: selected, conceptID: selected?.conceptID || null, - term: selected?.term || null, + term: selected?.term || null, });(Note: If the repo enforces trailingComma: 'all', this is already compliant. Including here due to lint hint near this block.)
62-64: Lint: remove stray blank line after suggestedDiagnosisListPrettier/lint flagged an extra newline.
- suggestedDiagnosisList: any = []; - + suggestedDiagnosisList: any = [];
124-138: Subscriptions without teardown (contextual)diagnosisSubscription is assigned but not unsubscribed in ngOnDestroy. Not introduced here, but consider adding OnDestroy to avoid leaks on navigation.
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/general-opd-diagnosis/general-opd-diagnosis.component.ts (3)
256-266: Debounce/cancel suggestion queries and clear stale selectionSame as other components: consider debouncing, canceling in-flight requests, and clearing conceptID/term when input < 3.
Minimal correctness patch:
if (value.length >= 3) { this.masterdataService .searchDiagnosisBasedOnPageNo(value, index) .subscribe((results: any) => { this.suggestedDiagnosisList[index] = results?.data?.sctMaster; }); } else { - this.suggestedDiagnosisList[index] = []; + this.suggestedDiagnosisList[index] = []; + const arr = this.generalDiagnosisForm.get('provisionalDiagnosisList') as FormArray; + const group = arr.at(index) as FormGroup; + group.patchValue({ conceptID: null, term: null }); }
268-285: onDiagnosisSelected logic is sound; keep trailing commaMatches template expectations and sets both display object and persisted identifiers. Ensure trailing comma per style.
diagnosisFormGroup.patchValue({ viewProvisionalDiagnosisProvided: selected, conceptID: selected?.conceptID || null, - term: selected?.term || null, + term: selected?.term || null, });
171-176: Remove console.log (optional)Logs inside core flows can clutter console. Suggest removing or gating under a debug flag.
- console.log('from diagnosis' + provisionalDiagnosis[0].term);src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-care-diagnosis/ncd-care-diagnosis.component.html (1)
121-143: MatAutocomplete wiring looks good; add debounce and trackBy for performanceThe per-row autocomplete is a solid UX improvement. Two small perf/UX tweaks:
- Debounce key input to avoid hammering the API and to prevent out‑of‑order responses.
- Add trackBy to the ngFor to reduce re-render churn.
Apply this diff to add trackBy, and I can follow up with a TS snippet to wire a debounced valueChanges if you want.
- *ngFor=" - let diagnosis of provisionalDiagnosisControls; - let i = index; - let isLast = last - " + *ngFor=" + let diagnosis of provisionalDiagnosisControls; + let i = index; + let isLast = last; + trackBy: trackByIndex + "Add the following helper in ncd-care-diagnosis.component.ts (outside this file):
// inside the component class trackByIndex = (index: number) => index;src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/general-opd-diagnosis/general-opd-diagnosis.component.html (1)
11-31: Provisional diagnosis autocomplete: good structure; add trackBy and debounceThe new autocomplete block is well-structured and consistent with other modules. Recommend:
- trackBy for the ngFor.
- Debounce key input (or switch to control.valueChanges + debounceTime + switchMap in TS) to cut down requests and race conditions.
Apply this diff for trackBy:
- *ngFor=" - let diagnosis of provisionalDiagnosisControls; - let i = index; - let isLast = last - " + *ngFor=" + let diagnosis of provisionalDiagnosisControls; + let i = index; + let isLast = last; + trackBy: trackByIndex + "Add in general-opd-diagnosis.component.ts:
trackByIndex = (index: number) => index;src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/pnc-diagnosis/pnc-diagnosis.component.ts (4)
96-96: Align with project style: drop explicit type annotationPer the team learning, class properties are declared without explicit type annotations. Consider:
[Suggest changing]
- suggestedDiagnosisList: any[] = []; + suggestedDiagnosisList = [];
98-106: Fix lint: trailing comma in multi-line constructor paramsLint reported “Insert ,”. Add a trailing comma to satisfy trailing-comma rules in multi-line parameter lists.
constructor( private confirmationService: ConfirmationService, private fb: FormBuilder, private beneficiaryDetailsService: BeneficiaryDetailsService, private doctorService: DoctorService, public httpServiceService: HttpServiceService, readonly sessionstorage: SessionStorageService, - private masterdataService: MasterdataService + private masterdataService: MasterdataService, ) {}
318-328: Avoid creating an extra blank row when patchingCalling
addProvisionalDiagnosis()on every iteration always leaves one extra empty row. If that’s intentional, ignore. Otherwise, gate it.- this.addProvisionalDiagnosis(); + // Add a new row only if there are more items to patch. + if (i < provisionalDiagnosisDataList.length - 1) { + this.addProvisionalDiagnosis(); + }
426-436: Throttle requests and handle errors to prevent race conditionsKeying on every keyup causes many overlapping requests; late responses can overwrite newer suggestions. Consider RxJS
valueChangeswithdebounceTime,distinctUntilChanged, andswitchMap, pluscatchErrorto default to [] on failure.Example (in TS; minimal sketch):
// in ngOnInit, for each row i (or on add), wire once: const ctrl = (this.generalDiagnosisForm.get('provisionalDiagnosisList') as FormArray).at(i).get('viewProvisionalDiagnosisProvided'); ctrl!.valueChanges.pipe( filter(v => typeof v === 'string' && v.length >= 3), debounceTime(250), distinctUntilChanged(), switchMap(v => this.masterdataService.searchDiagnosisBasedOnPageNo(v, i).pipe( map((r: any) => r?.data?.sctMaster ?? []), catchError(() => of([])), )), ).subscribe(list => this.suggestedDiagnosisList[i] = list);If you prefer to keep the current method, at least add error handling:
- .subscribe((results: any) => { - this.suggestedDiagnosisList[index] = results?.data?.sctMaster; - }); + .subscribe( + (results: any) => { + this.suggestedDiagnosisList[index] = results?.data?.sctMaster ?? []; + }, + () => { this.suggestedDiagnosisList[index] = []; }, + );src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-screening-diagnosis/ncd-screening-diagnosis.component.ts (3)
67-77: Style + lint: unify property typing and add trailing comma
- Align with project style: drop explicit type annotation on
suggestedDiagnosisList.- Add trailing comma in multi-line constructor params (lint hint at line ~76).
- suggestedDiagnosisList: any = []; + suggestedDiagnosisList = []; @@ readonly sessionstorage: SessionStorageService, - private masterdataService: MasterdataService + private masterdataService: MasterdataService,
214-224: Avoid extra blank row after patchUnconditional
this.addDiagnosis()in the loop leaves an extra empty row. Gate it unless intentionally desired.- this.addDiagnosis(); + if (i < savedDiagnosisData.length - 1) { + this.addDiagnosis(); + }
328-338: Whitespace + debounce/error handling
- There’s a stray leading space before the method name (lint hint “Delete ·”). Also consider adding error handling and (optionally) debouncing.
- onDiagnosisInputKeyup(value: string, index: number) { + onDiagnosisInputKeyup(value: string, index: number) { if (value.length >= 3) { this.masterdataService .searchDiagnosisBasedOnPageNo(value, index) - .subscribe((results: any) => { - this.suggestedDiagnosisList[index] = results?.data?.sctMaster; - }); + .subscribe( + (results: any) => { + this.suggestedDiagnosisList[index] = results?.data?.sctMaster ?? []; + }, + () => { this.suggestedDiagnosisList[index] = []; }, + ); } else { this.suggestedDiagnosisList[index] = []; } }If you want the full debounce+switchMap pattern, I can provide a compact patch.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (15)
Common-UI(1 hunks)pom.xml(2 hunks)src/app/app-modules/core/components/beneficiary-details/beneficiary-details.component.html(1 hunks)src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/general-opd-diagnosis/general-opd-diagnosis.component.html(1 hunks)src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/general-opd-diagnosis/general-opd-diagnosis.component.ts(5 hunks)src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-care-diagnosis/ncd-care-diagnosis.component.html(1 hunks)src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-care-diagnosis/ncd-care-diagnosis.component.ts(4 hunks)src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-screening-diagnosis/ncd-screening-diagnosis.component.html(1 hunks)src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-screening-diagnosis/ncd-screening-diagnosis.component.ts(6 hunks)src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/pnc-diagnosis/pnc-diagnosis.component.html(1 hunks)src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/pnc-diagnosis/pnc-diagnosis.component.ts(6 hunks)src/assets/Assamese.json(1 hunks)src/assets/English.json(1 hunks)src/assets/Hindi.json(1 hunks)src/environments/environment.ci.ts.template(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2024-12-04T10:56:48.977Z
Learnt from: devikasuresh20
PR: PSMRI/TM-UI#51
File: src/app/app-modules/nurse-doctor/vitals/general-patient-vitals/general-patient-vitals.component.html:645-650
Timestamp: 2024-12-04T10:56:48.977Z
Learning: In `src/app/app-modules/nurse-doctor/vitals/general-patient-vitals/general-patient-vitals.component.html`, the development team prefers to keep explicit and detailed conditional logic in the Angular template's `required` attributes to enhance readability and provide explicit clarity, even if it results in redundant code.
Applied to files:
src/app/app-modules/core/components/beneficiary-details/beneficiary-details.component.html
📚 Learning: 2024-12-04T10:57:51.584Z
Learnt from: devikasuresh20
PR: PSMRI/TM-UI#51
File: src/app/app-modules/nurse-doctor/vitals/general-patient-vitals/general-patient-vitals.component.html:696-701
Timestamp: 2024-12-04T10:57:51.584Z
Learning: In `src/app/app-modules/nurse-doctor/vitals/general-patient-vitals/general-patient-vitals.component.html`, when implementing `required` attribute conditions in Angular templates, prefer explicit and detailed logic for better clarity, even if it results in redundant expressions.
Applied to files:
src/app/app-modules/core/components/beneficiary-details/beneficiary-details.component.html
📚 Learning: 2024-12-16T11:12:21.417Z
Learnt from: helenKaryamsetty
PR: PSMRI/TM-UI#52
File: src/app/app-modules/nurse-doctor/workarea/workarea.component.ts:181-182
Timestamp: 2024-12-16T11:12:21.417Z
Learning: In the `src/app/app-modules/nurse-doctor/workarea/workarea.component.ts` file, and throughout the Angular project, class properties are declared without explicit type annotations to maintain consistency.
Applied to files:
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/pnc-diagnosis/pnc-diagnosis.component.ts
🪛 GitHub Check: lint-and-audit / lint-and-audit
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-care-diagnosis/ncd-care-diagnosis.component.ts
[failure] 64-64:
Delete ⏎
[failure] 291-291:
Insert ,
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/pnc-diagnosis/pnc-diagnosis.component.ts
[failure] 105-105:
Insert ,
[failure] 445-445:
Insert ,
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-screening-diagnosis/ncd-screening-diagnosis.component.ts
[failure] 76-76:
Insert ,
[failure] 347-347:
Insert ,
[failure] 328-328:
Delete ·
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/general-opd-diagnosis/general-opd-diagnosis.component.ts
[failure] 67-67:
Insert ,
[failure] 275-275:
Insert ,
🪛 GitHub Actions: ESLint and NPM Audit
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/general-opd-diagnosis/general-opd-diagnosis.component.ts
[error] 67-67: prettier/prettier: Insert , at line 67, column 49.
🔇 Additional comments (17)
Common-UI (1)
1-1: Verify Common-UI submodule pointer and CI configurationThe Common-UI submodule pointer was bumped to the new SHA—please ensure it’s valid upstream and that our CI pipelines properly initialize submodules:
• Extract and verify the pinned SHA against the remote
• Confirm CI jobs performgit submodule update --init --recursive(or Actions checkout withsubmodules: true)
• Double-check that any breaking UI/contract changes in Common-UI remain compatibleYou can run this updated script to validate everything end-to-end:
#!/usr/bin/env bash set -euo pipefail # 1) Get the commit SHA for the Common-UI submodule from the current index sha=$(git ls-tree HEAD Common-UI | awk '{print $3}') echo "Detected Common-UI submodule SHA: $sha" # 2) Locate the submodule URL in .gitmodules sub_name=$(git config -f .gitmodules --get-regexp 'submodule\..*\.path' \ | awk '$3=="Common-UI"{print $1}' \ | sed -E 's/submodule\.([^.]*)\.path/\1/') if [[ -z "$sub_name" ]]; then echo "ERROR: Could not find submodule path 'Common-UI' in .gitmodules" >&2 exit 1 fi url=$(git config -f .gitmodules "submodule.$sub_name.url") echo "Common-UI submodule URL: $url" # 3) Verify the SHA exists upstream if git ls-remote "$url" | grep -q "$sha"; then echo "OK: SHA $sha exists on remote $url" else echo "ERROR: SHA $sha not found on remote $url" >&2 exit 2 fi # 4) Scan CI definitions for submodule initialization echo "Scanning CI pipelines for submodule setup..." rg -n -S --hidden \ --glob '.github/workflows/**' \ --glob 'Jenkinsfile*' \ --glob 'azure-pipelines*.yml' \ --glob '.gitlab-ci.yml' \ --glob 'bitbucket-pipelines.yml' \ 'submodule|git submodule|actions/checkout.*submodules' || true echo "✅ Ensure your CI uses one of: • git submodule update --init --recursive • actions/checkout@v4 with submodules: recursive"src/assets/Hindi.json (1)
85-85: Adds bendetails.lastName – looks goodTranslation “उपनाम” is appropriate and aligns with other locales. No JSON syntax issues spotted.
src/assets/Assamese.json (2)
86-86: Adds bendetails.lastName – approved“উপাধী (চাৰন্যেম)” reads correctly and is consistent with Personal Info lastName. No structural issues.
81-105: Cross-locale consistency checkPlease confirm that any components rendering bendetails.lastName don’t hardcode English. The verification script in the Hindi.json comment will validate this across locales.
src/assets/English.json (1)
88-88: English bendetails.lastName added – OKLabel “Last Name” is fine. It complements existing ro.personalInfo.lastName without conflict.
pom.xml (2)
97-97: exec-maven-plugin → 3.4.0 – approvedUpgrade is fine. No incompatible configuration detected. Keep an eye on CI build logs for any npm/exec output changes in this plugin version.
8-8: Release notes missing for version 3.4.0 – please verifyI searched for any mention of “3.4.0” in changelog or release-notes files and found none. Before merging, please ensure that:
- The changelog or release-notes documentation is updated with the 3.4.0 entries
- The Git tag (e.g., v3.4.0) is created and pushed
src/environments/environment.ci.ts.template (1)
62-69: Confirm redirection pathsINVENTORY_URL uses “/#/redirin?” while redirInUrl is “/pharmacist/redirin”. The casing and path segment match; just confirm the downstream app expects query params appended to redirin?.
src/app/app-modules/core/components/beneficiary-details/beneficiary-details.component.html (1)
22-31: Conditional fatherName block looks correct and safeUses ng-container with a precise null/empty guard, consistent styling, and safe Angular interpolation. No concerns.
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-screening-diagnosis/ncd-screening-diagnosis.component.html (2)
21-35: MatAutocomplete integration aligns with other diagnosis componentsThe per-row autocomplete wiring (displayWith, optionSelected, keyup) and responsive layout look good and consistent with related components.
15-16: Verified TS backing members exist in NcdScreeningDiagnosisComponentI’ve confirmed that all of the template’s required members are implemented in
ncd-screening-diagnosis.component.ts:
suggestedDiagnosisList: any[]at line 67get provisionalDiagnosisControls(): AbstractControl[]at line 241onDiagnosisInputKeyup(value: string, index: number)at line 328displayDiagnosis(diagnosis: any): stringat line 340onDiagnosisSelected(selected: any, index: number)at line 344No further changes are needed here.
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/pnc-diagnosis/pnc-diagnosis.component.html (1)
19-33: Per-row autocomplete adoption looks goodThe move to provisionalDiagnosisControls with Material Autocomplete and displayWith is consistent and correct.
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-care-diagnosis/ncd-care-diagnosis.component.ts (1)
202-206: Getter for provisionalDiagnosisControls is clean and improves template readabilityGood extraction; reduces template coupling to FormArray internals.
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/general-opd-diagnosis/general-opd-diagnosis.component.ts (1)
209-214: Getter extraction is tidyprovisionalDiagnosisControls improves template clarity.
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/pnc-diagnosis/pnc-diagnosis.component.ts (1)
178-182: Getter LGTMReturning the FormArray’s controls as a list for the template is clear and consistent with the new pattern.
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-screening-diagnosis/ncd-screening-diagnosis.component.ts (2)
241-245: Getter LGTMReturning the controls array for the template is clear and consistent.
24-37: Import grouping LGTMBringing MasterdataService into the existing shared services import is consistent with other modules.
| <ng-container *ngIf="beneficiary?.lastName"> | ||
| <tr style="font-size: 14px; color: #000000"> | ||
| <th id="lastName"> | ||
| {{ current_language_set?.bendetails?.lastName }}: | ||
| </th> | ||
| </tr> | ||
| <tr style="color: #595959; font-size: 14px"> | ||
| <td>{{ beneficiary?.lastName }}</td> | ||
| </tr> | ||
| </ng-container> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Confirm i18n key availability for bendetails.lastName across all locales
Template references current_language_set?.bendetails?.lastName. Please verify corresponding entries exist in all shipped locale JSONs to avoid a blank header at runtime.
Run this to confirm:
🏁 Script executed:
#!/bin/bash
# Check translation keys for lastName across assets
fd -a '.*\.json$' src/assets | xargs -I{} rg -n '"bendetails"\s*:\s*\{[^}]*"lastName"' -n {}Length of output: 98
🏁 Script executed:
#!/usr/bin/env python3
import json, glob, sys
errors = False
# Search all JSON files under src/assets
for path in glob.glob("src/assets/**/*.json", recursive=True):
try:
with open(path, encoding="utf-8") as f:
data = json.load(f)
except json.JSONDecodeError as e:
echo "Error parsing {path}: {e}" >&2
errors = True
continue
# Check for 'bendetails' object
if "bendetails" not in data or not isinstance(data["bendetails"], dict):
print(f"{path}: missing or invalid 'bendetails' object")
errors = True
else:
# Check for 'lastName' key inside 'bendetails'
if "lastName" not in data["bendetails"]:
print(f"{path}: missing 'bendetails.lastName' key")
errors = True
if errors:
sys.exit(1)Length of output: 481
🏁 Script executed:
#!/bin/bash
set -e
# Iterate over all JSON locale files
find src/assets -type f -name '*.json' | while read -r file; do
# Use Python to validate presence of bendetails.lastName
python3 - "$file" << 'PYCODE'
import json, sys
path = sys.argv[1]
try:
data = json.load(open(path, encoding="utf-8"))
except Exception as e:
print(f"{path}: failed to parse JSON ({e})")
sys.exit(1)
if not isinstance(data.get("bendetails"), dict):
print(f"{path}: missing or invalid 'bendetails' object")
sys.exit(1)
if "lastName" not in data["bendetails"]:
print(f"{path}: missing 'bendetails.lastName' key")
sys.exit(1)
PYCODE
done
echo "✓ All locale files contain bendetails.lastName"Length of output: 172
#!/bin/bash
# Verify that bendetails.lastName exists in all locale JSONs under src/assets
python3 - << 'PYCODE'
import json, glob, sys
errors = False
# Gather all JSON files in src/assets, excluding git-version metadata
locale_files = [f for f in glob.glob('src/assets/**/*.json', recursive=True) if 'git-version' not in f]
if not locale_files:
print("Error: No locale JSON files found under src/assets")
sys.exit(1)
for path in sorted(locale_files):
try:
with open(path, encoding='utf-8') as fp:
data = json.load(fp)
except Exception as e:
print(f"{path}: failed to parse JSON ({e})")
errors = True
continue
# Ensure 'bendetails' is an object
if not isinstance(data.get("bendetails"), dict):
print(f"{path}: missing or invalid 'bendetails' object")
errors = True
else:
# Check for 'lastName' key
if "lastName" not in data["bendetails"]:
print(f"{path}: missing 'bendetails.lastName' key")
errors = True
if errors:
sys.exit(1)
else:
print("✓ All locale JSON files contain bendetails.lastName")
PYCODE🏁 Script executed:
#!/bin/bash
set -e
fail=0
# Iterate over all JSON files under src/assets, excluding git-version metadata
find src/assets -type f -name '*.json' ! -name '*git-version.json' | while read -r file; do
# Validate JSON and check for bendetails.lastName
python3 - << EOF
import json, sys
path = "$file"
try:
data = json.load(open(path, encoding="utf-8"))
except Exception as e:
print(f"{path}: failed to parse JSON ({e})")
sys.exit(1)
# Ensure 'bendetails' is a dict with 'lastName'
if not isinstance(data.get("bendetails"), dict) or "lastName" not in data["bendetails"]:
print(f"{path}: missing bendetails.lastName key")
sys.exit(1)
EOF
if [ $? -ne 0 ]; then
fail=1
fi
done
if [ $fail -eq 0 ]; then
echo "✓ All locale JSON files contain bendetails.lastName"
exit 0
else
exit 1
fiLength of output: 173
Add missing bendetails.lastName translation to locale files
We ran a validation across all JSON assets and found that the key bendetails.lastName is missing in the following file, which will lead to a blank header at runtime:
src/assets/language.json: missingbendetails.lastName
Please add the appropriate translation entry under the bendetails object in this file (and any other locales as needed) to ensure the label renders correctly.
🤖 Prompt for AI Agents
In
src/app/app-modules/core/components/beneficiary-details/beneficiary-details.component.html
around lines 32 to 41, the template references
current_language_set?.bendetails?.lastName but the key bendetails.lastName is
missing from the locale file; open src/assets/language.json and add a "lastName"
entry under the "bendetails" object with the appropriate translated string (and
mirror the same key/value into any other locale JSON files used by the app),
then save and run the localization/validation step to confirm the key is
present.
| constructor( | ||
| private fb: FormBuilder, | ||
| public httpServiceService: HttpServiceService, | ||
| private doctorService: DoctorService, | ||
| private confirmationService: ConfirmationService, | ||
| readonly sessionstorage: SessionStorageService, | ||
| private masterdataService: MasterdataService | ||
| ) {} | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prettier failure: trailing comma in constructor params
CI flagged “Insert ,” at line 67. Add a trailing comma after the last constructor param in multiline form.
constructor(
private fb: FormBuilder,
public httpServiceService: HttpServiceService,
private doctorService: DoctorService,
private confirmationService: ConfirmationService,
readonly sessionstorage: SessionStorageService,
- private masterdataService: MasterdataService
+ private masterdataService: MasterdataService,
) {}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| constructor( | |
| private fb: FormBuilder, | |
| public httpServiceService: HttpServiceService, | |
| private doctorService: DoctorService, | |
| private confirmationService: ConfirmationService, | |
| readonly sessionstorage: SessionStorageService, | |
| private masterdataService: MasterdataService | |
| ) {} | |
| constructor( | |
| private fb: FormBuilder, | |
| public httpServiceService: HttpServiceService, | |
| private doctorService: DoctorService, | |
| private confirmationService: ConfirmationService, | |
| readonly sessionstorage: SessionStorageService, | |
| private masterdataService: MasterdataService, | |
| ) {} |
🧰 Tools
🪛 GitHub Check: lint-and-audit / lint-and-audit
[failure] 67-67:
Insert ,
🪛 GitHub Actions: ESLint and NPM Audit
[error] 67-67: prettier/prettier: Insert , at line 67, column 49.
🤖 Prompt for AI Agents
In
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/general-opd-diagnosis/general-opd-diagnosis.component.ts
around lines 61 to 69, Prettier flagged a missing trailing comma on the last
constructor parameter; update the multiline constructor parameter list by adding
a trailing comma after the final parameter (private masterdataService:
MasterdataService,) so the formatter passes.
| onDiagnosisInputKeyup(value: string, index: number) { | ||
| if (value.length >= 3) { | ||
| this.masterdataService | ||
| .searchDiagnosisBasedOnPageNo(value, index) | ||
| .subscribe((results: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Confirm MasterdataService signature for searchDiagnosisBasedOnPageNo
As with NCD care, verify the second argument is intended to be row index.
🏁 Script executed:
#!/bin/bash
# Inspect MasterdataService signature
fd 'masterdata\.service\.(ts|js)$' src | xargs -I{} rg -n 'searchDiagnosisBasedOnPageNo\s*\(' {}Length of output: 169
Ensure correct usage of page number in searchDiagnosisBasedOnPageNo
The MasterdataService.searchDiagnosisBasedOnPageNo signature is:
searchDiagnosisBasedOnPageNo(searchTerm: any, pageNo: any) { … }(confirmed by the output of your inspection at line 166 of masterdata.service.ts).
In your component call:
onDiagnosisInputKeyup(value: string, index: number) {
if (value.length >= 3) {
this.masterdataService
.searchDiagnosisBasedOnPageNo(value, index)
.subscribe(…);the second argument (index) will be treated as the page number, not a row index. Please:
- Verify whether you really intend to pass the current row’s index as the pagination page number.
- If so, rename the parameter (and any related variables) from
indextopageNofor clarity. - Otherwise, compute or supply the correct page number to this method.
This change will prevent confusion about what the method expects and ensure pagination behaves as intended.
🤖 Prompt for AI Agents
In
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/general-opd-diagnosis/general-opd-diagnosis.component.ts
around lines 256-260, the method call passes the local parameter named index
into MasterdataService.searchDiagnosisBasedOnPageNo which treats the second
argument as a page number; confirm intent and either (a) if you really mean to
use the row index as the page number, rename the parameter and all related
variables from index to pageNo to make this explicit, or (b) if you meant to
pass a pagination value, compute or fetch the correct page number and pass that
instead of the row index, updating variable names for clarity.
| onDiagnosisInputKeyup(value: string, index: number) { | ||
| if (value.length >= 3) { | ||
| this.masterdataService | ||
| .searchDiagnosisBasedOnPageNo(value, index) | ||
| .subscribe((results: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Confirm MasterdataService signature for searchDiagnosisBasedOnPageNo
Second argument reads like a page number; here it’s the row index. Ensure the method expects row index (or ignores it). Otherwise, pass an actual pageNo and track row index locally.
🏁 Script executed:
#!/bin/bash
# Inspect MasterdataService signature and param names
fd 'masterdata\.service\.(ts|js)$' src | xargs -I{} rg -n 'searchDiagnosisBasedOnPageNo\s*\(' {}Length of output: 169
Fix incorrect argument usage for searchDiagnosisBasedOnPageNo
The MasterdataService.searchDiagnosisBasedOnPageNo method signature is
searchDiagnosisBasedOnPageNo(searchTerm: any, pageNo: any) { … }but here you’re passing the row index as pageNo, which will lead to unexpected paging behavior.
Please update the component to:
- Track the row’s index separately (e.g. in a local variable or within the results array)
- Pass a proper page number to
searchDiagnosisBasedOnPageNo(e.g. the current page counter, starting at 1)
Example diff in
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-care-diagnosis/ncd-care-diagnosis.component.ts (around lines 272–276):
onDiagnosisInputKeyup(value: string, index: number) {
if (value.length >= 3) {
- this.masterdataService
- .searchDiagnosisBasedOnPageNo(value, index)
+ // Use the actual page number (e.g. this.currentPage), not the row index
+ this.masterdataService
+ .searchDiagnosisBasedOnPageNo(value, this.currentPage)
.subscribe((results: any) => {
// handle results; use `index` only for row-specific logic🤖 Prompt for AI Agents
In
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-care-diagnosis/ncd-care-diagnosis.component.ts
around lines 272–276, the call to searchDiagnosisBasedOnPageNo(value, index)
incorrectly passes the row index as the pageNo; change this to pass a proper
page number (e.g. 1 or a maintained page counter) and keep the row index only
for UI bookkeeping. Update onDiagnosisInputKeyup to capture the row index in a
local variable or attach it to the input's model, call
searchDiagnosisBasedOnPageNo(searchTerm, pageNo) with a real page counter
(initialize to 1 and increment only when loading next pages), and ensure results
are merged back into the correct row using the preserved row index.
| onDiagnosisSelected(selected: any, index: number) { | ||
| // this.patientQuickConsultForm.get(['provisionalDiagnosisList', index])?.setValue(selected); | ||
| const diagnosisFormArray = this.generalDiagnosisForm.get( | ||
| 'provisionalDiagnosisList' | ||
| ) as FormArray; | ||
| const diagnosisFormGroup = diagnosisFormArray.at(index) as FormGroup; | ||
|
|
||
| // Set the nested and top-level fields | ||
| diagnosisFormGroup.patchValue({ | ||
| viewProvisionalDiagnosisProvided: selected, | ||
| conceptID: selected?.conceptID || null, | ||
| term: selected?.term || null, | ||
| }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normalize control value to string and satisfy trailing-comma lint
Keep viewProvisionalDiagnosisProvided as a string; add trailing comma to the multi-line .get( call.
- const diagnosisFormArray = this.generalDiagnosisForm.get(
- 'provisionalDiagnosisList'
- ) as FormArray;
+ const diagnosisFormArray = this.generalDiagnosisForm.get(
+ 'provisionalDiagnosisList',
+ ) as FormArray;
@@
diagnosisFormGroup.patchValue({
- viewProvisionalDiagnosisProvided: selected,
- conceptID: selected?.conceptID || null,
- term: selected?.term || null,
+ viewProvisionalDiagnosisProvided: selected?.term || '',
+ conceptID: selected?.conceptID ?? null,
+ term: selected?.term ?? null,
});📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| onDiagnosisSelected(selected: any, index: number) { | |
| // this.patientQuickConsultForm.get(['provisionalDiagnosisList', index])?.setValue(selected); | |
| const diagnosisFormArray = this.generalDiagnosisForm.get( | |
| 'provisionalDiagnosisList' | |
| ) as FormArray; | |
| const diagnosisFormGroup = diagnosisFormArray.at(index) as FormGroup; | |
| // Set the nested and top-level fields | |
| diagnosisFormGroup.patchValue({ | |
| viewProvisionalDiagnosisProvided: selected, | |
| conceptID: selected?.conceptID || null, | |
| term: selected?.term || null, | |
| }); | |
| } | |
| onDiagnosisSelected(selected: any, index: number) { | |
| // this.patientQuickConsultForm.get(['provisionalDiagnosisList', index])?.setValue(selected); | |
| const diagnosisFormArray = this.generalDiagnosisForm.get( | |
| 'provisionalDiagnosisList', | |
| ) as FormArray; | |
| const diagnosisFormGroup = diagnosisFormArray.at(index) as FormGroup; | |
| // Set the nested and top-level fields | |
| diagnosisFormGroup.patchValue({ | |
| viewProvisionalDiagnosisProvided: selected?.term || '', | |
| conceptID: selected?.conceptID ?? null, | |
| term: selected?.term ?? null, | |
| }); | |
| } |
🧰 Tools
🪛 GitHub Check: lint-and-audit / lint-and-audit
[failure] 347-347:
Insert ,
🤖 Prompt for AI Agents
In
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-screening-diagnosis/ncd-screening-diagnosis.component.ts
around lines 344 to 357, normalize the control value to a string and add the
trailing comma on the multi-line .get( call: change the
.get('provisionalDiagnosisList') call to include the trailing comma on its own
line, and when patching viewProvisionalDiagnosisProvided set it to a string
(e.g. selected ? String(selected) : '' or selected?.term ?? '' depending on
intended string field) instead of assigning the raw object; keep the rest of the
properties (conceptID, term) set as before and ensure trailing comma after the
closing quote in the .get( invocation.
| onDiagnosisInputKeyup(value: string, index: number) { | ||
| if (value.length >= 3) { | ||
| this.masterdataService | ||
| .searchDiagnosisBasedOnPageNo(value, index) | ||
| .subscribe((results: any) => { | ||
| this.suggestedDiagnosisList[index] = results?.data?.sctMaster; | ||
| }); | ||
| } else { | ||
| this.suggestedDiagnosisList[index] = []; | ||
| } | ||
| } | ||
|
|
||
| displayDiagnosis(diagnosis: any): string { | ||
| return typeof diagnosis === 'string' ? diagnosis : diagnosis?.term || ''; | ||
| } | ||
|
|
||
| onDiagnosisSelected(selected: any, index: number) { | ||
| // this.patientQuickConsultForm.get(['provisionalDiagnosisList', index])?.setValue(selected); | ||
| const diagnosisFormArray = this.generalDiagnosisForm.get( | ||
| 'provisionalDiagnosisList' | ||
| ) as FormArray; | ||
| const diagnosisFormGroup = diagnosisFormArray.at(index) as FormGroup; | ||
|
|
||
| // Set the nested and top-level fields | ||
| diagnosisFormGroup.patchValue({ | ||
| viewProvisionalDiagnosisProvided: selected, | ||
| conceptID: selected?.conceptID || null, | ||
| term: selected?.term || null, | ||
| }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
One more lint: trailing comma in multi-line call
Static analysis also flagged an “Insert ,” around line 445; the above change adds it. Re-run lint.
🏁 Script executed:
#!/bin/bash
# Verify no remaining trailing-comma issues in this file
rg -n "Insert `,`|Trailing comma" -g "src/app/**/pnc-diagnosis.component.ts" || trueLength of output: 179
🏁 Script executed:
#!/bin/bash
# Extract lines around the FormArray.get call to verify trailing comma insertion
sed -n '430,460p' src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/pnc-diagnosis/pnc-diagnosis.component.tsLength of output: 1023
Add missing trailing comma in the multi-line get() call
The call to this.generalDiagnosisForm.get( spans multiple lines and needs a trailing comma after the lone argument. Without it, the ESLint “Insert ,” rule will continue to fail.
• File: src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/pnc-diagnosis/pnc-diagnosis.component.ts
• Location: around line 445
Suggested diff:
- const diagnosisFormArray = this.generalDiagnosisForm.get(
- 'provisionalDiagnosisList'
- ) as FormArray;
+ const diagnosisFormArray = this.generalDiagnosisForm.get(
+ 'provisionalDiagnosisList',
+ ) as FormArray;After applying this change, please re-run the linter to confirm the trailing-comma error is resolved.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| onDiagnosisInputKeyup(value: string, index: number) { | |
| if (value.length >= 3) { | |
| this.masterdataService | |
| .searchDiagnosisBasedOnPageNo(value, index) | |
| .subscribe((results: any) => { | |
| this.suggestedDiagnosisList[index] = results?.data?.sctMaster; | |
| }); | |
| } else { | |
| this.suggestedDiagnosisList[index] = []; | |
| } | |
| } | |
| displayDiagnosis(diagnosis: any): string { | |
| return typeof diagnosis === 'string' ? diagnosis : diagnosis?.term || ''; | |
| } | |
| onDiagnosisSelected(selected: any, index: number) { | |
| // this.patientQuickConsultForm.get(['provisionalDiagnosisList', index])?.setValue(selected); | |
| const diagnosisFormArray = this.generalDiagnosisForm.get( | |
| 'provisionalDiagnosisList' | |
| ) as FormArray; | |
| const diagnosisFormGroup = diagnosisFormArray.at(index) as FormGroup; | |
| // Set the nested and top-level fields | |
| diagnosisFormGroup.patchValue({ | |
| viewProvisionalDiagnosisProvided: selected, | |
| conceptID: selected?.conceptID || null, | |
| term: selected?.term || null, | |
| }); | |
| } | |
| onDiagnosisSelected(selected: any, index: number) { | |
| // this.patientQuickConsultForm.get(['provisionalDiagnosisList', index])?.setValue(selected); | |
| const diagnosisFormArray = this.generalDiagnosisForm.get( | |
| 'provisionalDiagnosisList', | |
| ) as FormArray; | |
| const diagnosisFormGroup = diagnosisFormArray.at(index) as FormGroup; | |
| // Set the nested and top-level fields | |
| diagnosisFormGroup.patchValue({ | |
| viewProvisionalDiagnosisProvided: selected, | |
| conceptID: selected?.conceptID || null, | |
| term: selected?.term || null, | |
| }); | |
| } |
🧰 Tools
🪛 GitHub Check: lint-and-audit / lint-and-audit
[failure] 445-445:
Insert ,
🤖 Prompt for AI Agents
In
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/pnc-diagnosis/pnc-diagnosis.component.ts
around lines 426 to 455 the multi-line call this.generalDiagnosisForm.get(
'provisionalDiagnosisList' ) needs a trailing comma after the lone argument to
satisfy the ESLint "Insert , " rule; update the get(...) call to include a
trailing comma on the multi-line argument, save, and re-run the linter to
confirm the error is resolved.
| onDiagnosisSelected(selected: any, index: number) { | ||
| // this.patientQuickConsultForm.get(['provisionalDiagnosisList', index])?.setValue(selected); | ||
| const diagnosisFormArray = this.generalDiagnosisForm.get( | ||
| 'provisionalDiagnosisList' | ||
| ) as FormArray; | ||
| const diagnosisFormGroup = diagnosisFormArray.at(index) as FormGroup; | ||
|
|
||
| // Set the nested and top-level fields | ||
| diagnosisFormGroup.patchValue({ | ||
| viewProvisionalDiagnosisProvided: selected, | ||
| conceptID: selected?.conceptID || null, | ||
| term: selected?.term || null, | ||
| }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep control value a string; add trailing comma in multi-line call
Storing the entire object in viewProvisionalDiagnosisProvided mixes types (string when loaded vs. object when selected) and can invalidate native minlength/maxlength. Store the term (string) and keep conceptID/term in their own fields. Also add a trailing comma to the multi-line .get( call to satisfy lint.
- const diagnosisFormArray = this.generalDiagnosisForm.get(
- 'provisionalDiagnosisList'
- ) as FormArray;
+ const diagnosisFormArray = this.generalDiagnosisForm.get(
+ 'provisionalDiagnosisList',
+ ) as FormArray;
const diagnosisFormGroup = diagnosisFormArray.at(index) as FormGroup;
// Set the nested and top-level fields
diagnosisFormGroup.patchValue({
- viewProvisionalDiagnosisProvided: selected,
- conceptID: selected?.conceptID || null,
- term: selected?.term || null,
+ viewProvisionalDiagnosisProvided: selected?.term || '',
+ conceptID: selected?.conceptID ?? null,
+ term: selected?.term ?? null,
});📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| onDiagnosisSelected(selected: any, index: number) { | |
| // this.patientQuickConsultForm.get(['provisionalDiagnosisList', index])?.setValue(selected); | |
| const diagnosisFormArray = this.generalDiagnosisForm.get( | |
| 'provisionalDiagnosisList' | |
| ) as FormArray; | |
| const diagnosisFormGroup = diagnosisFormArray.at(index) as FormGroup; | |
| // Set the nested and top-level fields | |
| diagnosisFormGroup.patchValue({ | |
| viewProvisionalDiagnosisProvided: selected, | |
| conceptID: selected?.conceptID || null, | |
| term: selected?.term || null, | |
| }); | |
| } | |
| onDiagnosisSelected(selected: any, index: number) { | |
| // this.patientQuickConsultForm.get(['provisionalDiagnosisList', index])?.setValue(selected); | |
| const diagnosisFormArray = this.generalDiagnosisForm.get( | |
| 'provisionalDiagnosisList', | |
| ) as FormArray; | |
| const diagnosisFormGroup = diagnosisFormArray.at(index) as FormGroup; | |
| // Set the nested and top-level fields | |
| diagnosisFormGroup.patchValue({ | |
| viewProvisionalDiagnosisProvided: selected?.term || '', | |
| conceptID: selected?.conceptID ?? null, | |
| term: selected?.term ?? null, | |
| }); | |
| } |
🧰 Tools
🪛 GitHub Check: lint-and-audit / lint-and-audit
[failure] 445-445:
Insert ,
🤖 Prompt for AI Agents
In
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/pnc-diagnosis/pnc-diagnosis.component.ts
around lines 442 to 455, the handler currently stores the whole selected object
into viewProvisionalDiagnosisProvided and omits a trailing comma on the
multi-line .get( call; change the assignment so viewProvisionalDiagnosisProvided
is set to the selected.term (or null) to keep the control value a string while
still setting conceptID and term separately, and add the missing trailing comma
after the 'provisionalDiagnosisList' argument in the .get( call to satisfy
linting; ensure null-coalescing (selected?.term || null) is used for all three
fields to avoid runtime errors.
| const mmuUICasesheet = '<%= TM_API_BASE %>'; | ||
| const SCHEDULER_UI = '<%= SCHEDULER_UI_BASE %>'; | ||
| const INVENTORY_UI = '<%= INVENTORY_UI_BASE %>'; | ||
| const INVENTORY_UI = '<%= INVENTORY_UI %>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Template var name changed (INVENTORY_UI_BASE → INVENTORY_UI): verify pipeline inputs
If CI/CD still passes INVENTORY_UI_BASE, this change will render INVENTORY_UI undefined at template time and break INVENTORY_URL. Either update the pipeline to provide INVENTORY_UI or keep backward compatibility with an OR fallback using EJS.
Apply this backward-compatible diff:
-const INVENTORY_UI = '<%= INVENTORY_UI %>';
+// Prefer INVENTORY_UI; fallback to INVENTORY_UI_BASE if older pipelines still set it
+const INVENTORY_UI = '<%= INVENTORY_UI || INVENTORY_UI_BASE %>';🏁 Script executed:
#!/bin/bash
# Check if INVENTORY_UI_BASE is referenced elsewhere and ensure only one of the vars is required
rg -n "INVENTORY_UI_BASE|INVENTORY_UI" src -g '!**/node_modules/**'Length of output: 255
Verify pipeline inputs or add a backward-compatibility fallback for INVENTORY_UI
We ran a search for both variables and found only the new INVENTORY_UI in the template—no remaining references to INVENTORY_UI_BASE. If your CI/CD pipeline still provides INVENTORY_UI_BASE, the template will render INVENTORY_UI as undefined and break INVENTORY_URL.
Please address this by either:
- Updating your pipeline to supply
INVENTORY_UI(instead ofINVENTORY_UI_BASE), or - Adding a fallback in the EJS template for backward compatibility
Affected file:
- src/environments/environment.ci.ts.template (lines 43 and 62)
Recommended diff:
- const INVENTORY_UI = '<%= INVENTORY_UI %>';
+ // Prefer INVENTORY_UI; fallback to INVENTORY_UI_BASE if older pipelines still set it
+ const INVENTORY_UI = '<%= INVENTORY_UI || INVENTORY_UI_BASE %>';📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const INVENTORY_UI = '<%= INVENTORY_UI %>'; | |
| // Prefer INVENTORY_UI; fallback to INVENTORY_UI_BASE if older pipelines still set it | |
| const INVENTORY_UI = '<%= INVENTORY_UI || INVENTORY_UI_BASE %>'; |
🤖 Prompt for AI Agents
In src/environments/environment.ci.ts.template around lines 43 and 62, the
template currently uses INVENTORY_UI only which will render undefined if
pipeline still provides INVENTORY_UI_BASE; update the template to add a
backward-compatible fallback so INVENTORY_UI resolves to the new variable if
present, otherwise to INVENTORY_UI_BASE (or an empty default), and update any
dependent INVENTORY_URL construction to use that resolved value; alternatively,
update your CI pipeline to supply INVENTORY_UI instead of INVENTORY_UI_BASE.


📋 Description
JIRA ID:
Please provide a summary of the change and the motivation behind it. Include relevant context and details.
✅ Type of Change
ℹ️ Additional Information
Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.
Summary by CodeRabbit
New Features
Localization
Chores