Skip to content

Commit

Permalink
Merge branch 'develop' into fixes#7296
Browse files Browse the repository at this point in the history
  • Loading branch information
khavinshankar committed Sep 23, 2024
2 parents 1657392 + fc64a14 commit 9661253
Show file tree
Hide file tree
Showing 345 changed files with 9,184 additions and 11,199 deletions.
6 changes: 4 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Whitelabelling envs

REACT_APP_TITLE=CARE
REACT_APP_META_DESCRIPTION=Revolutionizing EMR with AI: Open Healthcare Network develops free, open-source tools to enhance efficiency in global healthcare delivery. Our EMR system is recognized as a Digital Public Good by the United Nations.
REACT_APP_META_DESCRIPTION="Revolutionizing EMR with AI: Open Healthcare Network develops free, open-source tools to enhance efficiency in global healthcare delivery. Our EMR system is recognized as a Digital Public Good by the United Nations."
REACT_APP_COVER_IMAGE=https://cdn.ohc.network/care_logo.svg
REACT_APP_COVER_IMAGE_ALT=https://cdn.ohc.network/care_logo.svg
REACT_PUBLIC_URL=https://care.ohc.network

# Care API URL without the /api prefix
REACT_CARE_API_URL=https://careapi.ohc.network

# Dev envs
ESLINT_NO_DEV_ERRORS=true

CARE_CDN_URL="https://egov-s3-facility-10bedicu.s3.amazonaws.com https://egov-s3-patient-data-10bedicu.s3.amazonaws.com http://localhost:4566"
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dotenv
test -f .env.local && dotenv .env.local
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:i18next/recommended",
"plugin:prettier/recommended",
"plugin:storybook/recommended"
"plugin:prettier/recommended"
],
"overrides": [
{
Expand Down
79 changes: 79 additions & 0 deletions .example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Backend URL
REACT_CARE_API_URL=https://careapi.ohc.network

# Dashboard URL
REACT_DASHBOARD_URL=

# GitHub URL (default: https://github.com/ohcnetwork)
REACT_GITHUB_URL=

# OHCN URL (default: https://ohc.network?ref=care)
REACT_OHCN_URL=

# Plausible site domain (default: care.ohc.network)
REACT_PLAUSIBLE_SITE_DOMAIN=

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


# Main logo (JSON string with light and dark properties)
REACT_HEADER_LOGO=

# Main logo (JSON string with light and dark properties)
# Example: REACT_MAIN_LOGO="{\"light\": \"https://cdn.ohc.network/light-logo.svg\", \"dark\": \"https://cdn.ohc.network/dark-logo.svg\"}"
REACT_MAIN_LOGO=

# State logo (JSON string with light and dark properties)
REACT_STATE_LOGO=

# Custom logo (JSON string with light and dark properties)
REACT_CUSTOM_LOGO=

# Custom alternative logo (JSON string with light and dark properties)
REACT_CUSTOM_LOGO_ALT=

# Custom description
REACT_CUSTOM_DESCRIPTION=

# Google Maps API key
REACT_GMAPS_API_KEY=

# Government data API key
REACT_GOV_DATA_API_KEY=

# reCAPTCHA site key
REACT_RECAPTCHA_SITE_KEY=

# Sentry DSN
REACT_SENTRY_DSN=

# Sentry environment (default: staging)
REACT_SENTRY_ENVIRONMENT=

# KASP settings
REACT_KASP_ENABLED=true
REACT_KASP_STRING=KASP
REACT_KASP_FULL_STRING=Karunya Arogya Suraksha Padhathi

# Sample format file paths
REACT_SAMPLE_FORMAT_ASSET_IMPORT=/asset-import-template.xlsx
REACT_SAMPLE_FORMAT_EXTERNAL_RESULT_IMPORT=/External-Results-Template.csv

# Camera feed, still watching idle timeout (in seconds; default: 180)
REACT_STILL_WATCHING_IDLE_TIMEOUT=

# Camera feed, still watching prompt duration (in seconds; default: 30)
REACT_STILL_WATCHING_PROMPT_DURATION=

# Feature flags
REACT_ENABLE_HCX=true
REACT_ENABLE_ABDM=true
REACT_ENABLE_SCRIBE=true
REACT_WARTIME_SHIFTING=true

# JWT token refresh interval (in milliseconds) (default: 5 minutes)
REACT_JWT_TOKEN_REFRESH_INTERVAL=

# Minimum encounter date (default: 2020-01-01)
REACT_MIN_ENCOUNTER_DATE=
1 change: 1 addition & 0 deletions .github/runner-files/jwks.b64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJrZXlzIjogW3sibiI6ICJ4X21fNGNKQ3NHTHN4WkFIa2VCbFZQa2ZqNFNSckdHN3UySERFM3VLX3dFNERhTWhHQ2lxTXFsaTFDM2pxSE5JTVhuWV9ab1M5R3pHbnJpdGg1UUZGVDlLMGtBdF9YaXBJNnV1djcwOWtOV2FFNXZrYks4VlFRcFd2UFp4NUJSeTBGay0wU2lxZG1xOTNJRXdUTnNTLUpETnRXQm5VX0F1cjU0UXptQmI3SmhfOGttRDAtaHhROVZVejRpSUU3QTlySU5vQXNHSHhfdGtuNXd6YmpPR3F2Q3JqRi1RWXo0OGJXVkZzVVliNkFqUlFrZER2RWVwQlpNSHZsNVUxQlZxOVdRTTJGTmRUR0tJb3ZYeDRuTDFybUVONHpxbEpqWmc2bEZiODVuOUhkc01VblFiSXhkUjVlVl8wWmNVaHBrQWc0NldrejRZWkxMNm5NaGR0RmFTMXciLCAiZSI6ICJBUUFCIiwgImQiOiAiRXo4T3dDZ2xxZnREWlhwSXVEbjhGck1KWGhNNHZfb0NDdlZNUko1QjBPd3BuR3BrWDRKZWF4VFJYYkZ5OVQzdkowX2VXZjRQcl9XZUloMk5HZnpkaGw5NmtJUzd5R2JxQkhSY0U3a2ZhVWFkbHlDTVdnZDV5TEk1aWVOQUw5N2w4X1o2N0w5NHRIX3VlUF80Q1pXV0hGVTNieXJ4bHVzSld6NmZ5SFVPczlVSDFxV284V1RNOVp0RndqV0cxOWpkUXZ1RkQ0Z0x4UEJYZEk5ZV9zdTNwbmZHR0ZkN0xfMDFwcEFkQ2Y5eHhNTWFEel8wZ0xXM0NENFhnWU1rS2d3eDdKWlVlN0VaWFhyU0lETzFZN202MmF4NEpZRU5pSDFiaVlwQk15dmVfM3FzdnRQOWR4eVg2VkFROGZFNVdnOTBCcThsd1F0NzROWmgzMHhD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JWS2R0ZW1jT3J6M3NnTnk0ekZrZElTbUZfbmdnbFlJb080TjNza1NNUXdGY1B0S1kzWUVlT2ZGNzMzRDZaTVJtSTFTby12QU54YVBDUkREbnUwTWk1TnUzbS02SkhGSFF5RDU2ZTFsQUlwUS1lakpuTWR6MXQ0aUplbEFzIiwgImt0eSI6ICJSU0EiLCAia2lkIjogIlhjckcyVS0tR3B4SVhORXpKOWNWREdRaEUzeXlIamREMDN1aDZmYXpRX2siLCAiYWxnIjogIlJTMjU2In1dfQ==
10 changes: 7 additions & 3 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5, 6, 7, 8]
env:
REACT_CARE_API_URL: http://localhost:9000
steps:
- name: Checkout 📥
uses: actions/checkout@v3
Expand All @@ -42,9 +44,13 @@ jobs:
run: |
cd care
echo DISABLE_RATELIMIT=True >> docker/.prebuilt.env
echo "CORS_ALLOWED_ORIGINS=\"[\\\"http://localhost:4000\\\"]\"" >> docker/.prebuilt.env
echo JWKS_BASE64=\"$(cat ../.github/runner-files/jwks.b64.txt)\" >> docker/.prebuilt.env
make docker_config_file=docker-compose.pre-built.yaml up
make docker_config_file=docker-compose.pre-built.yaml load-dummy-data
cd ..
env:
JWKS_BASE64: ${{ secrets.JWKS_BASE64 }}

- name: Wait for care to be up ♻
uses: nick-fields/retry@v2
Expand All @@ -66,7 +72,7 @@ jobs:
- name: Install dependencies 📦
run: npm install

- name: Build & Compile rescript files ⚙️
- name: Build ⚙️
run: npm run build

- name: Install Specific Chrome Version
Expand All @@ -89,7 +95,6 @@ jobs:
parallel: true
group: "UI-Chrome"
env:
CARE_API: http://localhost:9000
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: --max_old_space_size=4096
Expand All @@ -111,7 +116,6 @@ jobs:
group: "UI-Chrome"
env:
CYPRESS_SPLIT_TESTS: "true"
CARE_API: http://localhost:9000
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: --max_old_space_size=4096
Expand Down
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ yarn-error.log*
dist
dev-dist
build
storybook-static
.swp
stats.json
public/build-meta.json
.vscode/*
!.vscode/launch.json
src/supportedBrowsers.ts


# Reason React
# Reason React
/lib/bs/**
.merlin
*.bs.js
Expand Down
3 changes: 0 additions & 3 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@
"arrowParens": "always",
"tailwindFunctions": [
"classNames"
],
"plugins": [
"prettier-plugin-tailwindcss"
]
}
27 changes: 0 additions & 27 deletions .storybook/main.ts

This file was deleted.

3 changes: 0 additions & 3 deletions .storybook/preview-head.html

This file was deleted.

15 changes: 0 additions & 15 deletions .storybook/preview.ts

This file was deleted.

2 changes: 0 additions & 2 deletions .storybook/vite.config.mts

This file was deleted.

6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

[![](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)

[![Storybook](https://raw.githubusercontent.com/storybooks/brand/master/badge/badge-storybook.svg)](https://careui.coronasafe.in)
[![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)
Expand Down Expand Up @@ -82,11 +81,11 @@ To ensure the quality of our pull requests, we use a variety of tools:

To run cypress tests locally, you'll need to setup the backend to run locally and load dummy data required for cypress to the database. See [docs](https://github.com/ohcnetwork/care#self-hosting).

Once backend is running locally, you'll have to ensure your local front-end is connected to local backend, by setting the `CARE_API` env.
Once backend is running locally, you'll have to ensure your local front-end is connected to local backend, by setting the `REACT_CARE_API_URL` env.

```env
#.env
CARE_API=http://127.0.0.1:9000
REACT_CARE_API_URL=http://127.0.0.1:9000
```

Once done, start the development server by running
Expand Down Expand Up @@ -116,7 +115,6 @@ npm run cypress:open # To debug and run tests individually.

- [CARE Documentation](https://docs.ohc.network/docs/care)
- [Swagger API Documentation](https://careapi.ohc.network/swagger/)
- [Storybook component library](https://careui.coronasafe.in/)
- [Testing Documentation](https://docs.coronasafe.network/care-testing-documentation/)

## 🚀 Production
Expand Down
112 changes: 112 additions & 0 deletions care.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
const env = import.meta.env;

interface ILogo {
light: string;
dark: string;
}

const logo = (value?: string, fallback?: ILogo) => {
if (!value) {
return fallback;
}

try {
return JSON.parse(value) as ILogo;
} catch {
// TODO: define vite plugin to validate care.config.ts during build step
return fallback;
}
};
const careConfig = {
apiUrl: env.REACT_CARE_API_URL,

urls: {
dashboard: env.REACT_DASHBOARD_URL,
github: env.REACT_GITHUB_URL || "https://github.com/ohcnetwork",
ohcn: env.REACT_OHCN_URL || "https://ohc.network?ref=care",
},

headerLogo: logo(env.REACT_HEADER_LOGO, {
light: "https://cdn.ohc.network/header_logo.png",
dark: "https://cdn.ohc.network/header_logo.png",
}),
mainLogo: logo(env.REACT_MAIN_LOGO, {
light: "https://cdn.ohc.network/light-logo.svg",
dark: "https://cdn.ohc.network/black-logo.svg",
}),
stateLogo: logo(env.REACT_STATE_LOGO),
customLogo: logo(env.REACT_CUSTOM_LOGO),
customLogoAlt: logo(env.REACT_CUSTOM_LOGO_ALT),
customDescription: env.REACT_CUSTOM_DESCRIPTION,

gmapsApiKey:
env.REACT_GMAPS_API_KEY || "AIzaSyDsBAc3y7deI5ZO3NtK5GuzKwtUzQNJNUk",

govDataApiKey:
env.REACT_GOV_DATA_API_KEY ||
"579b464db66ec23bdd000001cdd3946e44ce4aad7209ff7b23ac571b",
reCaptchaSiteKey:
env.REACT_RECAPTCHA_SITE_KEY || "6LdvxuQUAAAAADDWVflgBqyHGfq-xmvNJaToM0pN",

kasp: {
enabled: env.REACT_KASP_ENABLED === "true",
string: env.REACT_KASP_STRING || "KASP",
fullString:
env.REACT_KASP_FULL_STRING || "Karunya Arogya Suraksha Padhathi",
},

sampleFormats: {
assetImport:
env.REACT_SAMPLE_FORMAT_ASSET_IMPORT || "/asset-import-template.xlsx",
externalResultImport:
env.REACT_SAMPLE_FORMAT_EXTERNAL_RESULT_IMPORT ||
"/External-Results-Template.csv",
},

wartimeShifting: env.REACT_WARTIME_SHIFTING === "true",

stillWatching: {
idleTimeout: env.REACT_STILL_WATCHING_IDLE_TIMEOUT
? parseInt(env.REACT_STILL_WATCHING_IDLE_TIMEOUT)
: 3 * 60,
promptDuration: env.REACT_STILL_WATCHING_PROMPT_DURATION
? parseInt(env.REACT_STILL_WATCHING_PROMPT_DURATION)
: 30,
},

auth: {
tokenRefreshInterval: env.REACT_JWT_TOKEN_REFRESH_INTERVAL
? parseInt(env.REACT_JWT_TOKEN_REFRESH_INTERVAL)
: 5 * 60e3,
},

minEncounterDate: new Date(env.REACT_MIN_ENCOUNTER_DATE || "2020-01-01"),

// Plugins related configs...

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

sentry: {
dsn:
env.REACT_SENTRY_DSN ||
"https://[email protected]/5183632",
environment: env.REACT_SENTRY_ENVIRONMENT || "staging",
},

hcx: {
enabled: env.REACT_ENABLE_HCX === "true",
},

abdm: {
enabled: (env.REACT_ENABLE_ABDM ?? "true") === "true",
},

scribe: {
enabled: env.REACT_ENABLE_SCRIBE === "true",
},
} as const;

export default careConfig;
2 changes: 2 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
files:
- source: /src/Locale/en/*.json
translation: /src/Locale/%two_letters_code%/%original_file_name%
bundles:
- 2
4 changes: 4 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ export default defineConfig({
requestTimeout: 15000,
excludeSpecPattern: "**/*roles.cy.ts",
},
env: {
API_URL: process.env.REACT_CARE_API_URL ?? "http://localhost:9000",
ENABLE_HCX: process.env.REACT_ENABLE_HCX ?? false,
},
});
Loading

0 comments on commit 9661253

Please sign in to comment.