Skip to content

Commit

Permalink
Merge branch 'develop' into issues/8795/Apt-Zindex-in-Doctors-notes
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 authored Oct 22, 2024
2 parents 7d0e25e + 5b3a86a commit a830ef2
Show file tree
Hide file tree
Showing 188 changed files with 198,364 additions and 10,576 deletions.
23 changes: 23 additions & 0 deletions .cursorrules
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Care is a React Typescript Project, built with Vite and styled with TailwindCSS.

Care uses a Plugin Architecture. Apps are installed in /apps.

Care uses a custom useQuery hook to fetch data from the API. APIs are defined in the api.tsx file

Here's an example of how to use the useQuery hook to fetch data from the API:

```
useQuery from "@/Common/hooks/useQuery";
const { data, loading, error } = useQuery(routes.getFacilityUsers, {
facility_id: "1",
});

request from "@/Common/utils/request";
const { res } = await request(routes.partialUpdateAsset, {
pathParams: { external_id: assetId },
body: data,
});
```



2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"cpus": 4
},
"waitFor": "onCreateCommand",
"postCreateCommand": "npm install",
"postCreateCommand": "npm run install-all",
"postAttachCommand": {
"server": "npm run dev"
},
Expand Down
2 changes: 2 additions & 0 deletions .env.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Care API URL without the /api prefix
REACT_CARE_API_URL=http://localhost:9000
4 changes: 3 additions & 1 deletion .example.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ REACT_OHCN_URL=
# Plausible site domain (default: care.ohc.network)
REACT_PLAUSIBLE_SITE_DOMAIN=

# Plausible server URL (default: https://plausible.10bedicu.in)
# Plausible server URL (default: https://plausible.ohc.network)
REACT_PLAUSIBLE_SERVER_URL=

# Care Apps. repo@branch seperated by commas
REACT_ENABLED_APPS="ohcnetwork/care_livekit_fe@main,ohcnetwork/care_scribe"

# Main logo (JSON string with light and dark properties)
REACT_HEADER_LOGO=
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
node-version: "20"

- name: Install dependencies 📦
run: npm install
run: npm run install-all

- name: Build ⚙️
run: npm run build
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/generate-sbom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Generate SBOM using CycloneDX

on:
workflow_dispatch:

jobs:
generate-sbom:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install dependencies
run: npm ci

- name: Install CycloneDX NPM tool
run: npm install -g @cyclonedx/cyclonedx-npm

- name: Generate SBOM
run: cyclonedx-npm --output-file sbom.json

- name: Upload SBOM
uses: actions/upload-artifact@v3
with:
name: sbom
path: sbom.json
if-no-files-found: error
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,7 @@ bun.lockb
# Cypress
cypress/downloads
cypress/fixtures/token.json

# Care Apps
/apps/*
src/pluginMap.ts
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
7 changes: 3 additions & 4 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"semi": true,
"jsxSingleQuote": false,
"arrowParens": "always",
"tailwindFunctions": [
"classNames"
]
}
"tailwindFunctions": ["classNames"],
"plugins": ["prettier-plugin-tailwindcss"]
}
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ RUN npm install

COPY . .

RUN npm run setup

RUN npm run build


Expand Down
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
<a href="https://ohc.network/">
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.ohc.network/light-logo.svg">
<img alt="CARE Logo" src="https://user-images.githubusercontent.com/25143503/193396107-27e0d587-b195-4e95-a795-5d0663d5cd81.svg">
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ohcnetwork/branding/refs/heads/main/Care/SVG/Logo/Care-Logo_gradient_mark_with_white_wordmark.svg">
<img alt="CARE Logo" src="https://raw.githubusercontent.com/ohcnetwork/branding/refs/heads/main/Care/SVG/Logo/Care-Logo_gradient_mark_with_dark_wordmark.svg" width="400">
</picture>
</p>
</a>
<p align="center"><b>Our goal is to continuously improve the quality and accessibility of public healthcare services using digital tools.</b></p>
<h2></h2>
<h3 align="center"><a href="https://care.ohc.network" target="_blank">🚀 Staging Deploy</a></h3>
<p align="center"><img src="https://api.netlify.com/api/v1/badges/fd123f42-ef65-448c-9b03-39959d60e60b/deploy-status"></p>
<h3 align="center"><a href="https://care.ohc.network" target="_blank">🚀 Staging Deployment</a></h3>
<center>

[![Netlify Status](https://api.netlify.com/api/v1/badges/de76351f-b1f0-4bf8-8445-d9faf6391b13/deploy-status)](https://app.netlify.com/sites/care-ohc/deploys)

</center>
<p align="center">Auto deployed to <a href="https://care.ohc.network/">care.ohc.network</a> for <code>develop</code> branch. All pull requests have preview builds powered by <a href="https://netlify.com">Netlify</a>.</p>

[![](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/images/0)](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/links/0)[![](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/images/1)](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/links/1)[![](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/images/2)](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/links/2)[![](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/images/3)](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/links/3)[![](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/images/4)](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/links/4)[![](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/images/5)](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/links/5)[![](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/images/6)](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/links/6)[![](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/images/7)](https://sourcerer.io/fame/tomahawk-pilot/ohcnetwork/care_fe/links/7)

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=coronasafe_care_fe&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=coronasafe_care_fe)
![Code scanning - action](https://github.com/ohcnetwork/care_fe/workflows/Code%20scanning%20-%20action/badge.svg)
![OSSAR](https://github.com/ohcnetwork/care_fe/workflows/OSSAR/badge.svg)
[![Cypress Tests](https://img.shields.io/endpoint?url=https://cloud.cypress.io/badge/simple/wf7d2m/develop&style=flat&logo=cypress)](https://cloud.cypress.io/projects/wf7d2m/runs)
![Staging Release](https://github.com/ohcnetwork/care_fe/workflows/CARE%20Develop%20Registry/badge.svg)
![Production Release](https://github.com/ohcnetwork/care_fe/workflows/Production%20Release/badge.svg)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/200482ab117e4b5397ff3f5ae5719aa2)](https://www.codacy.com/gh/ohcnetwork/care_fe?utm_source=github.com&utm_medium=referral&utm_content=ohcnetwork/care_fe&utm_campaign=Badge_Grade)
[![CircleCI](https://circleci.com/gh/ohcnetwork/care_fe.svg?style=svg)](https://circleci.com/gh/ohcnetwork/care_fe)
[![Maintainability](https://api.codeclimate.com/v1/badges/f1438f693aa459805301/maintainability)](https://codeclimate.com/github/ohcnetwork/care_fe/maintainability)

## Getting started
Expand All @@ -33,7 +35,14 @@
#### Install the required dependencies

```sh
npm install
npm run install-all
```
#### First-time setup

For first-time setup, run the following command to generate the pluginMap and install plugin configurations:

```sh
npm run setup
```

#### 🏃 Run the app in development mode
Expand Down
9 changes: 8 additions & 1 deletion care.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const careConfig = {
// Plugins related configs...

plausible: {
server: env.REACT_PLAUSIBLE_SERVER_URL || "https://plausible.10bedicu.in",
server: env.REACT_PLAUSIBLE_SERVER_URL || "https://plausible.ohc.network",
domain: env.REACT_PLAUSIBLE_SITE_DOMAIN || "care.ohc.network",
},

Expand All @@ -103,6 +103,13 @@ const careConfig = {
abdm: {
enabled: (env.REACT_ENABLE_ABDM ?? "true") === "true",
},

careApps: env.REACT_ENABLED_APPS
? env.REACT_ENABLED_APPS.split(",").map((app) => ({
branch: app.split("@")[1],
package: app.split("@")[0],
}))
: [],
} as const;

export default careConfig;
1 change: 1 addition & 0 deletions cypress/e2e/auth_spec/auth.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ describe("Authorisation/Authentication", () => {
it("Try login as admin with correct password", () => {
cy.loginByApi("devdistrictadmin", "Coronasafe@123");
cy.awaitUrl("/facility");
cy.get("#user-profile-name").click();
cy.get("#sign-out-button").contains("Sign Out").click();
cy.url().should("include", "/");
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/PatientBedManagement.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe("Patient swtich bed functionality", () => {
const patientConsultationPage = new PatientConsultationPage();
const switchBedOne = "Dummy Bed 4";
const switchBedTwo = "Dummy Bed 1";
const switchBedThree = "Dummy Bed 3";
const switchBedThree = "Dummy Bed 7";
const switchPatientOne = "Dummy Patient 6";
const switchPatientTwo = "Dummy Patient 7";

Expand Down
3 changes: 1 addition & 2 deletions cypress/e2e/patient_spec/PatientDoctorConnect.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ describe("Patient Doctor Connect in consultation page", () => {
const doctorconnect = new DoctorConnect();
const patientName = "Dummy Patient 11";
const doctorUser = "Dev Doctor";
const doctorUserNumber = "+919876543219";
const nurseUser = "Dev Staff";
const teleIcuUser = "Dev Doctor Two";

Expand Down Expand Up @@ -37,7 +36,7 @@ describe("Patient Doctor Connect in consultation page", () => {
"#doctor-connect-home-doctor",
doctorUser,
);
doctorconnect.verifyCopiedContent(doctorUserNumber);
doctorconnect.verifyCopiedContent();
// verify the whatsapp and phone number icon presence
doctorconnect.verifyIconVisible("#whatsapp-icon");
doctorconnect.verifyIconVisible("#phone-icon");
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/PatientDoctorNotes.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("Patient Discussion notes in the consultation page", () => {
cy.verifyNotification(discussionNotesSuccessMessage);
cy.closeNotification();
// verify the auto-switching of tab to nurse notes if the user is a nurse
cy.get("#sign-out-button").contains("Sign Out").click();
patientDoctorNotes.signout();
loginPage.loginManuallyAsNurse();
loginPage.ensureLoggedIn();
cy.visit("/patients");
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/patient_spec/PatientLogUpdate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientRhythm,
]);
patientLogupdate.clickUpdateDetail();
patientLogupdate.clickClearButtonInElement("#systolic");
patientLogupdate.clearIntoElementById("#systolic");
patientLogupdate.typeSystolic(patientModifiedSystolic);
patientLogupdate.clickClearButtonInElement("#diastolic");
patientLogupdate.clearIntoElementById("#diastolic");
patientLogupdate.typeDiastolic(patientModifiedDiastolic);
cy.submitButton("Continue");
cy.verifyNotification("Brief Update updated successfully");
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/users_spec/UsersCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ describe("User Creation", () => {

it("Update the existing user profile and verify its reflection", () => {
userCreationPage.clickElementById("user-profile-name");
userCreationPage.clickElementById("profile-button");
userCreationPage.verifyElementContainsText(
"username-profile-details",
"devdistrictadmin",
Expand Down Expand Up @@ -129,6 +130,7 @@ describe("User Creation", () => {

it("Update the existing user profile Form Mandatory File Error", () => {
userCreationPage.clickElementById("user-profile-name");
userCreationPage.clickElementById("profile-button");
userCreationPage.clickElementById("edit-cancel-profile-button");
userCreationPage.clearIntoElementById("firstName");
userCreationPage.clearIntoElementById("lastName");
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/users_spec/UsersHomepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("User Homepage", () => {
const altPhoneNumber = "8878825662";
const homeFacility = "Dummy Facility 40";
const nurseUserName = "dummynurse1";
const doctorUserName = "devdoctor";
const doctorUserName = "devdoctor1";

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/users_spec/UsersManage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ describe("Manage User", () => {

beforeEach(() => {
cy.restoreLocalStorage();
console.log(localStorage);
cy.clearLocalStorage(/filters--.+/);
console.log(localStorage);
cy.awaitUrl("/users");
});

Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/users_spec/UsersProfile.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ describe("Manage User Profile", () => {

beforeEach(() => {
cy.restoreLocalStorage();
console.log(localStorage);
cy.clearLocalStorage(/filters--.+/);
console.log(localStorage);
cy.awaitUrl("/user/profile");
});

Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class AssetPage {
}

clickConfigureAsset() {
cy.get("#submit").contains("Set Configuration").click();
cy.get("#submit").contains("Update").click();
}

clickConfigureVital() {
Expand Down
4 changes: 2 additions & 2 deletions cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class FacilityPage {
}

fillAddress(address: string) {
cy.get("#address").click().clear().type(address);
cy.get("#address").click().type(address);
}

fillPhoneNumber(phoneNumber: string) {
Expand Down Expand Up @@ -297,7 +297,7 @@ class FacilityPage {

selectLocation(location: string) {
cy.intercept("https://maps.googleapis.com/**").as("mapApi");
cy.get("span > svg.care-svg-icon__baseline.care-l-map-marker").click();
cy.get("#facility-location-button").click();
cy.wait("@mapApi").its("response.statusCode").should("eq", 200);
cy.get("input#pac-input").type(location).type("{enter}");
cy.wait(2000);
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Facility/FacilityHome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class FacilityHome {
}

verifyOccupancyBadgeVisibility() {
cy.get("#occupany-badge").should("be.visible");
cy.get('[data-test-id="occupancy-badge"]').should("be.visible");
}

verifyAndCloseNotifyModal() {
Expand Down
12 changes: 6 additions & 6 deletions cypress/pageobject/Facility/FacilityManage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class FacilityManage {
clickCoverImage() {
cy.get("#facility-coverimage").click({ force: true });
cy.get("#facility-coverimage").click();
}

verifyUploadButtonVisible() {
Expand All @@ -13,6 +13,11 @@ class FacilityManage {
.wait(100); // Adjust the wait time as needed
}

clickSaveCoverImage() {
cy.get("#save-cover-image").scrollIntoView();
cy.get("#save-cover-image").click();
}

verifyTotalDoctorCapacity(expectedCapacity: string) {
cy.get("#facility-doctor-totalcapacity").contains(expectedCapacity);
}
Expand All @@ -37,11 +42,6 @@ class FacilityManage {
cy.get("#delete-facility-bedcapacity").click();
}

clickSaveCoverImage() {
cy.get("#save-cover-image").scrollIntoView();
cy.get("#save-cover-image").click();
}

clickFacilityConfigureButton() {
cy.get("#configure-facility").should("be.visible");
cy.get("#configure-facility").click();
Expand Down
2 changes: 2 additions & 0 deletions cypress/pageobject/Login/LoginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class LoginPage {
}

ensureLoggedIn(): void {
cy.get("#user-profile-name").click();
cy.get("#sign-out-button").scrollIntoView();
cy.get("#sign-out-button").contains("Sign Out").should("exist");
}
}
Expand Down
4 changes: 2 additions & 2 deletions cypress/pageobject/Patient/PatientDoctorConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export class DoctorConnect {
});
}

verifyCopiedContent(text: string) {
cy.get("@clipboardStub").should("be.calledWith", text);
verifyCopiedContent() {
cy.get("@clipboardStub").should("be.calledWithMatch", /^\+91\d{10}$/);
}

verifyIconVisible(selector: string) {
Expand Down
6 changes: 6 additions & 0 deletions cypress/pageobject/Patient/PatientDoctorNotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,10 @@ export class PatientDoctorNotes {
.its("response.statusCode")
.should("eq", 201);
}

signout() {
cy.get("#user-profile-name").click();
cy.get("#sign-out-button").scrollIntoView();
cy.get("#sign-out-button").contains("Sign Out").click();
}
}
Loading

0 comments on commit a830ef2

Please sign in to comment.