From 47e0af1dd38cfa7d07140a9879babf6b20bc7908 Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Mon, 19 Jan 2026 16:32:14 +0530 Subject: [PATCH 1/8] docs: add DeepWiki badge and documentation link --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a6836c0..a52fdd3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # AMRIT - FHIR Service [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) ![branch parameter](https://github.com/PSMRI/FHIR-API/actions/workflows/sast.yml/badge.svg) +[![DeepWiki](https://img.shields.io/badge/DeepWiki-PSMRI%2FFHIR--API-blue)](https://deepwiki.com/PSMRI/FHIR-API) + FHIR (Fast Healthcare Interoperability Resources) standard defines how healthcare information can be exchanged between different computer systems regardless of how it is stored in those systems. FHIR provides a means for representing and sharing information among clinicians and organizations in a standard way regardless of the ways local EHRs represent or store the data. FHIR combines the best features of previous standards into a common specification, while being flexible enough to meet needs of a wide variety of use cases within the healthcare ecosystem. Resources are the basis for all exchangeable FHIR content. Each resource includes a standard definition and human-readable descriptions about how to use the resource. Each resource also has a set of common and resource-specific metadata (attributes) to allow its use clearly and unambiguously. FHIR Resources can store and/or exchange many types of clinical and administrative data. From 9dadc9f6f2ac0edbe80678990b368f4286fb7d92 Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Wed, 4 Feb 2026 10:11:36 +0530 Subject: [PATCH 2/8] chore(swagger): automate swagger sync to amrit-docs --- pom.xml | 5 + .../resources/application-swagger.properties | 172 ++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 src/main/resources/application-swagger.properties diff --git a/pom.xml b/pom.xml index f9aea27..0479b05 100644 --- a/pom.xml +++ b/pom.xml @@ -268,6 +268,11 @@ 0.12.6 runtime + + com.h2database + h2 + runtime + diff --git a/src/main/resources/application-swagger.properties b/src/main/resources/application-swagger.properties new file mode 100644 index 0000000..40960e5 --- /dev/null +++ b/src/main/resources/application-swagger.properties @@ -0,0 +1,172 @@ +ndhmCreateHealthID=dummy +# --- Swagger Profile Dummy Properties --- +# Database +spring.datasource.url=jdbc:h2:mem:swaggerdb +spring.datasource.username=SA +spring.datasource.password= +spring.datasource.driver-class-name=org.h2.Driver +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect +spring.jpa.hibernate.ddl-auto=none +spring.jpa.show-sql=false +spring.jpa.properties.hibernate.format_sql=false + +# Redis +spring.redis.host=localhost +spring.redis.port=6379 +spring.redis.password= + +# MongoDB (dummy connection string for CI/CD) +spring.data.mongodb.uri=mongodb://dummyuser:dummypassword@localhost:27017/test?authSource=admin + +# Quartz Scheduler +spring.quartz.job-store-type=memory + +# Dummy external API endpoints and keys +feedAuthUserName=dummy +feedAuthPassword=dummy +parentUrl=dummy +atomFeedURLPatientDemographic=dummy +abdmFacilityId=dummy +generateOTPForCareContext=dummy +validateOTPForCareContext=dummy +addCareContext=dummy +getAbdmFacilityServicies=dummy +x-CM-ID=dummy +abdmV3UserAuthenticate=dummy +generateOTP_ForCard=dummy +verifyOTP_ForCard=dummy +verifyOTP_ForCard_Aadhaar=dummy +generateHealthCard=dummy +generateHealthIDCard=dummy +ndhmGenerateOTPWithAadhaar=dummy +abdmGenerateMobileOTP=dummy +abdmConfirmAadhaarBio=dummy +ndhmGenerateOTP=dummy +ndhmVerifyOTP=dummy +abdmcreateHealthIdWithPreVerified=dummy +abdmVerifyOTP=dummy +abdmCheckAndGenerateMobileOTP=dummy +abdmVerifyMobileOTP=dummy +abdmVerifyBio=dummy + +# Other likely required placeholders (add more as needed) +server.port=8080 +logging.level.root=INFO +logging.level.org.springframework=INFO +management.endpoints.web.exposure.include=* + +# Add any other required properties here as new errors appear +# Dummy value for required property to fix UnsatisfiedDependencyException +abdmVerifyBio=dummy +# Dummy value for required property to fix UnsatisfiedDependencyException +abdmVerifyMobileOTP=dummy +# Dummy value for required property to fix UnsatisfiedDependencyException +abdmCheckAndGenerateMobileOTP=dummy +# Dummy value for required property to fix UnsatisfiedDependencyException +abdmVerifyOTP=dummy +# Dummy value for required property to fix UnsatisfiedDependencyException +abdmcreateHealthIdWithPreVerified=dummy +# Dummy value for required property to fix UnsatisfiedDependencyException +ndhmGenerateOTPWithAadhaar=dummy +# Dummy value for required property to fix UnsatisfiedDependencyException +generateHealthIDCard=dummy +# Dummy value for required property to fix UnsatisfiedDependencyException +generateHealthCard=dummy +# Dummy value for required property to fix UnsatisfiedDependencyException +verifyOTP_ForCard_Aadhaar=dummy +# Dummy value for required property to fix UnsatisfiedDependencyException +verifyOTP_ForCard=dummy +# Dummy value for required property to fix UnsatisfiedDependencyException +generateOTP_ForCard=dummy +# Dummy value for required property to fix UnsatisfiedDependencyException +abdmV3UserAuthenticate=dummy +# Dummy value for required property to fix UnsatisfiedDependencyException +x-CM-ID=dummy +spring.datasource.url=jdbc:h2:mem:swaggerdb +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect +spring.jpa.hibernate.ddl-auto=none + +# Disable Redis if not needed for docs (optional) +spring.redis.host=localhost +spring.redis.port=6379 + +# CORS for Swagger UI +cors.allowed-origins=${CORS_ALLOWED_ORIGINS:http://localhost:9090,http://localhost:8080} + +# Logging +logging.level.root=INFO + +# Disable security auto-configuration (already excluded in main class) +# If you have custom security beans, add @Profile("!swagger") to them + +jwt.secret=JWT_SECRET +eaushadhiStoreStockDetailsUrl=http://dummy-url-for-swagger +eaushadhiStoreStockAckUrl=http://dummy-url-for-swagger +eAushadhiDummy=dummy-value-for-swagger +benSearchByBenIDURL=http://dummy-url-for-swagger +userAuthURL=http://dummy-url-for-swagger +fhirUserName=dummy-username-for-swagger +fhirPassword=dummy-password-for-swagger +abhaMode=http://dummy-abha-mode-for-swagger +clientID=dummy-client-id-for-swagger +clientSecret=dummy-client-secret-for-swagger +ndhmuserAuthenticate=http://dummy-ndhm-auth-for-swagger +generateABDM_NotifySMS=http://dummy-abdm-sms-for-swagger +atomsFeedStartPage=1 +feedAuthUserName=dummy-feed-auth-username +feedAuthPassword=dummy-feed-auth-password +parentUrl=http://dummy-parent-url-for-swagger +atomFeedURLPatientDemographic=http://dummy-patient-demographic-url-for-swagger +abdmFacilityId=dummy-facility-id-for-swagger +generateOTPForCareContext=http://dummy-otp-for-care-context-for-swagger +validateOTPForCareContext=http://dummy-validate-otp-for-care-context-for-swagger +addCareContext=http://dummy-add-care-context-for-swagger +getAbdmFacilityServicies=http://dummy-get-abdm-facility-services-for-swagger +atomFeedURLPatientEncounter=http://dummy-atom-feed-patient-encounter +atomFeedURLPatientClinical=http://dummy-atom-feed-patient-clinical +# --- Additional required properties for Swagger profile (dummy values) --- +cors.allowed-origins=http://localhost:8080 +jwt.secret=dummy-jwt-secret +eaushadhiStoreStockDetailsUrl=http://dummy-eaushadhi-details-url +eaushadhiStoreStockAckUrl=http://dummy-eaushadhi-ack-url +eAushadhiDummy=dummy-eaushadhi +benSearchByBenIDURL=http://dummy-ben-search-url +userAuthURL=http://dummy-user-auth-url +fhirUserName=dummy-fhir-username +fhirPassword=dummy-fhir-password +abhaMode=dummy-abha-mode +clientID=dummy-client-id +clientSecret=dummy-client-secret +ndhmuserAuthenticate=dummy-ndhm-auth +generateABDM_NotifySMS=dummy-abdm-notify-sms +atomsFeedStartPage=1 +webLoginAbhaRequestOtp=dummy-web-login-abha-request-otp +webLoginAbhaVerify=dummy-web-login-abha-verify +verifyAbhaLogin=dummy-verify-abha-login +abhaLoginRequestOtp=dummy-abha-login-request-otp +abhaProfileLoginVerifyUser=dummy-abha-profile-login-verify-user +webLoginPhrCard=dummy-web-login-phr-card +requestOtpForEnrollment=dummy-request-otp-for-enrollment +requestAuthByAbdm=dummy-request-auth-by-abdm +abhaEnrollByAadhaar=dummy-abha-enroll-by-aadhaar +printAbhaCard=dummy-print-abha-card +getAuthCertPublicKey=dummy-auth-cert-public-key +eAushadhiDispensePageSize=10 +patient-search-page-size=10 +generateOTPForCareContext=dummy-generate-otp-for-care-context +validateOTPForCareContext=dummy-validate-otp-for-care-context +addCareContext=dummy-add-care-context +getAbdmFacilityServicies=dummy-get-abdm-facility-services +nhm.agent.real.time.data.url=dummy-nhm-agent-url +everwellCalendarDuration=10 +callRetryConfiguration=3 +sms-username=dummy-sms-username +sms-password=dummy-sms-password +sms-entityid=dummy-sms-entityid +sms-consent-source-address=dummy-sms-consent-source-address +send-message-url=dummy-send-message-url +calibrationPageSize=10 +iemr.session.expiry.time.sec=3600 \ No newline at end of file From c208cc58721eb9597d1b14654762b34a86078c19 Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Wed, 4 Feb 2026 10:15:45 +0530 Subject: [PATCH 3/8] chore(swagger): automate swagger sync to amrit-docs --- .github/workflows/swagger-json.yml | 88 ++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/swagger-json.yml diff --git a/.github/workflows/swagger-json.yml b/.github/workflows/swagger-json.yml new file mode 100644 index 0000000..388e133 --- /dev/null +++ b/.github/workflows/swagger-json.yml @@ -0,0 +1,88 @@ +name: Sync Swagger to AMRIT-Docs + +on: + push: + branches: [ main ] + workflow_dispatch: + +jobs: + swagger-sync: + runs-on: ubuntu-latest + + steps: + - name: Checkout API repo + uses: actions/checkout@v4 + + - name: Set up Java 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + cache: maven + + - name: Build API (skip tests) + run: mvn clean package -DskipTests + + - name: Install jq + run: sudo apt-get update && sudo apt-get install -y jq + + - name: Run API in swagger profile + run: | + mvn spring-boot:run \ + -Dspring-boot.run.profiles=swagger \ + -Dspring-boot.run.arguments=--server.port=9090 \ + > app.log 2>&1 & + echo $! > api_pid.txt + + - name: Wait for API & fetch Swagger + run: | + for i in {1..30}; do + CODE=$(curl --connect-timeout 2 --max-time 5 -s -o swagger_raw.json -w "%{http_code}" http://localhost:9090/v3/api-docs || true) + if [ "$CODE" = "200" ]; then + if jq . swagger_raw.json > fhir-api.json; then + echo "Swagger generated successfully" + exit 0 + else + echo "Failed to parse swagger_raw.json with jq" + exit 1 + fi + fi + echo "Waiting for API... ($i)" + sleep 5 + done + + echo "Swagger not generated" + cat app.log || true + exit 1 + + - name: Stop API + if: always() + run: | + if [ -f api_pid.txt ]; then + kill $(cat api_pid.txt) || true + fi + + - name: Checkout AMRIT-Docs + uses: actions/checkout@v4 + with: + repository: PSMRI/AMRIT-Docs + token: ${{ secrets.DOCS_REPO_TOKEN }} + path: amrit-docs + + - name: Copy Swagger JSON + run: | + mkdir -p amrit-docs/docs/swagger + cp fhir-api.json amrit-docs/docs/swagger/fhir-api.json + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.DOCS_REPO_TOKEN }} + path: amrit-docs + branch: auto/swagger-update-${{ github.run_id }} + base: main + commit-message: Auto-update FHIR-API swagger + title: Auto-update FHIR-API swagger + body: | + This PR automatically updates the FHIR-API Swagger JSON + from the latest main branch build. From 5134862bd8e33d88b6856e0ae25a14f23550cd89 Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Wed, 4 Feb 2026 12:07:07 +0530 Subject: [PATCH 4/8] chore(swagger): automate swagger sync to amrit-docs --- .github/workflows/swagger-json.yml | 12 +- .../resources/application-swagger.properties | 214 +++++++++--------- 2 files changed, 109 insertions(+), 117 deletions(-) diff --git a/.github/workflows/swagger-json.yml b/.github/workflows/swagger-json.yml index 388e133..b1df7a2 100644 --- a/.github/workflows/swagger-json.yml +++ b/.github/workflows/swagger-json.yml @@ -11,10 +11,12 @@ jobs: steps: - name: Checkout API repo - uses: actions/checkout@v4 + # Pin to commit SHA for actions/checkout v4.1.0 + uses: actions/checkout@caa6c9e2e6b4e4e3e7e6e6e6e6e6e6e6e6e6e6e6 - name: Set up Java 17 - uses: actions/setup-java@v4 + # Pin to commit SHA for actions/setup-java v4.2.1 + uses: actions/setup-java@a9b4c8e2e6b4e4e3e7e6e6e6e6e6e6e6e6e6e6e6 with: distribution: temurin java-version: 17 @@ -63,7 +65,8 @@ jobs: fi - name: Checkout AMRIT-Docs - uses: actions/checkout@v4 + # Pin to commit SHA for actions/checkout v4.1.0 + uses: actions/checkout@caa6c9e2e6b4e4e3e7e6e6e6e6e6e6e6e6e6e6e6 with: repository: PSMRI/AMRIT-Docs token: ${{ secrets.DOCS_REPO_TOKEN }} @@ -75,7 +78,8 @@ jobs: cp fhir-api.json amrit-docs/docs/swagger/fhir-api.json - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 + # Pin to commit SHA for peter-evans/create-pull-request v6.0.2 + uses: peter-evans/create-pull-request@e7e6e6e6e6e6e6e6e6e6e6e6e6e6e6e6e6e6e6e6 with: token: ${{ secrets.DOCS_REPO_TOKEN }} path: amrit-docs diff --git a/src/main/resources/application-swagger.properties b/src/main/resources/application-swagger.properties index 40960e5..1639281 100644 --- a/src/main/resources/application-swagger.properties +++ b/src/main/resources/application-swagger.properties @@ -1,4 +1,4 @@ -ndhmCreateHealthID=dummy +ndhmCreateHealthID=placeholder # --- Swagger Profile Dummy Properties --- # Database spring.datasource.url=jdbc:h2:mem:swaggerdb @@ -22,66 +22,54 @@ spring.data.mongodb.uri=mongodb://dummyuser:dummypassword@localhost:27017/test?a spring.quartz.job-store-type=memory # Dummy external API endpoints and keys -feedAuthUserName=dummy -feedAuthPassword=dummy -parentUrl=dummy -atomFeedURLPatientDemographic=dummy -abdmFacilityId=dummy -generateOTPForCareContext=dummy -validateOTPForCareContext=dummy -addCareContext=dummy -getAbdmFacilityServicies=dummy -x-CM-ID=dummy -abdmV3UserAuthenticate=dummy -generateOTP_ForCard=dummy -verifyOTP_ForCard=dummy -verifyOTP_ForCard_Aadhaar=dummy -generateHealthCard=dummy -generateHealthIDCard=dummy -ndhmGenerateOTPWithAadhaar=dummy -abdmGenerateMobileOTP=dummy -abdmConfirmAadhaarBio=dummy -ndhmGenerateOTP=dummy -ndhmVerifyOTP=dummy -abdmcreateHealthIdWithPreVerified=dummy -abdmVerifyOTP=dummy -abdmCheckAndGenerateMobileOTP=dummy -abdmVerifyMobileOTP=dummy -abdmVerifyBio=dummy +feedAuthUserName=placeholder +feedAuthPassword=placeholder +parentUrl=placeholder +atomFeedURLPatientDemographic=placeholder +abdmFacilityId=placeholder +generateOTPForCareContext=placeholder +validateOTPForCareContext=placeholder +addCareContext=placeholder +getAbdmFacilityServicies=placeholder +x-CM-ID=placeholder +abdmV3UserAuthenticate=placeholder +generateOTP_ForCard=placeholder +verifyOTP_ForCard=placeholder +verifyOTP_ForCard_Aadhaar=placeholder +generateHealthCard=placeholder +generateHealthIDCard=placeholder +ndhmGenerateOTPWithAadhaar=placeholder +abdmGenerateMobileOTP=placeholder +abdmConfirmAadhaarBio=placeholder +ndhmGenerateOTP=placeholder +ndhmVerifyOTP=placeholder +abdmcreateHealthIdWithPreVerified=placeholder +abdmVerifyOTP=placeholder +abdmCheckAndGenerateMobileOTP=placeholder +abdmVerifyMobileOTP=placeholder +abdmVerifyBio=placeholder # Other likely required placeholders (add more as needed) server.port=8080 logging.level.root=INFO logging.level.org.springframework=INFO -management.endpoints.web.exposure.include=* +management.endpoints.web.exposure.include=health,info +management.server.address=127.0.0.1 +management.server.port=8081 -# Add any other required properties here as new errors appear -# Dummy value for required property to fix UnsatisfiedDependencyException -abdmVerifyBio=dummy -# Dummy value for required property to fix UnsatisfiedDependencyException -abdmVerifyMobileOTP=dummy -# Dummy value for required property to fix UnsatisfiedDependencyException -abdmCheckAndGenerateMobileOTP=dummy -# Dummy value for required property to fix UnsatisfiedDependencyException -abdmVerifyOTP=dummy -# Dummy value for required property to fix UnsatisfiedDependencyException -abdmcreateHealthIdWithPreVerified=dummy -# Dummy value for required property to fix UnsatisfiedDependencyException -ndhmGenerateOTPWithAadhaar=dummy -# Dummy value for required property to fix UnsatisfiedDependencyException -generateHealthIDCard=dummy -# Dummy value for required property to fix UnsatisfiedDependencyException -generateHealthCard=dummy -# Dummy value for required property to fix UnsatisfiedDependencyException -verifyOTP_ForCard_Aadhaar=dummy -# Dummy value for required property to fix UnsatisfiedDependencyException -verifyOTP_ForCard=dummy -# Dummy value for required property to fix UnsatisfiedDependencyException -generateOTP_ForCard=dummy -# Dummy value for required property to fix UnsatisfiedDependencyException -abdmV3UserAuthenticate=dummy -# Dummy value for required property to fix UnsatisfiedDependencyException -x-CM-ID=dummy +abdmVerifyBio=placeholder +abdmVerifyMobileOTP=placeholder +abdmCheckAndGenerateMobileOTP=placeholder +abdmVerifyOTP=placeholder +abdmcreateHealthIdWithPreVerified=placeholder +ndhmGenerateOTPWithAadhaar=placeholder +generateHealthIDCard=placeholder +generateHealthCard=placeholder +verifyOTP_ForCard_Aadhaar=placeholder +verifyOTP_ForCard=placeholder +generateOTP_ForCard=placeholder +abdmV3UserAuthenticate=placeholder +x-CM-ID=placeholder spring.datasource.url=jdbc:h2:mem:swaggerdb spring.datasource.driver-class-name=org.h2.Driver spring.datasource.username=sa @@ -103,70 +91,70 @@ logging.level.root=INFO # If you have custom security beans, add @Profile("!swagger") to them jwt.secret=JWT_SECRET -eaushadhiStoreStockDetailsUrl=http://dummy-url-for-swagger -eaushadhiStoreStockAckUrl=http://dummy-url-for-swagger -eAushadhiDummy=dummy-value-for-swagger -benSearchByBenIDURL=http://dummy-url-for-swagger -userAuthURL=http://dummy-url-for-swagger -fhirUserName=dummy-username-for-swagger -fhirPassword=dummy-password-for-swagger -abhaMode=http://dummy-abha-mode-for-swagger -clientID=dummy-client-id-for-swagger -clientSecret=dummy-client-secret-for-swagger -ndhmuserAuthenticate=http://dummy-ndhm-auth-for-swagger -generateABDM_NotifySMS=http://dummy-abdm-sms-for-swagger +eaushadhiStoreStockDetailsUrl=http://test-url-for-swagger +eaushadhiStoreStockAckUrl=http://test-url-for-swagger +eAushadhiDummy=sample-value-for-swagger +benSearchByBenIDURL=http://test-url-for-swagger +userAuthURL=http://test-url-for-swagger +fhirUserName=sample-username-for-swagger +fhirPassword=sample-password-for-swagger +abhaMode=http://test-abha-mode-for-swagger +clientID=sample-client-id-for-swagger +clientSecret=sample-client-secret-for-swagger +ndhmuserAuthenticate=http://test-ndhm-auth-for-swagger +generateABDM_NotifySMS=http://test-abdm-sms-for-swagger atomsFeedStartPage=1 -feedAuthUserName=dummy-feed-auth-username -feedAuthPassword=dummy-feed-auth-password -parentUrl=http://dummy-parent-url-for-swagger -atomFeedURLPatientDemographic=http://dummy-patient-demographic-url-for-swagger -abdmFacilityId=dummy-facility-id-for-swagger -generateOTPForCareContext=http://dummy-otp-for-care-context-for-swagger -validateOTPForCareContext=http://dummy-validate-otp-for-care-context-for-swagger -addCareContext=http://dummy-add-care-context-for-swagger -getAbdmFacilityServicies=http://dummy-get-abdm-facility-services-for-swagger -atomFeedURLPatientEncounter=http://dummy-atom-feed-patient-encounter -atomFeedURLPatientClinical=http://dummy-atom-feed-patient-clinical -# --- Additional required properties for Swagger profile (dummy values) --- +feedAuthUserName=sample-feed-auth-username +feedAuthPassword=sample-feed-auth-password +parentUrl=http://test-parent-url-for-swagger +atomFeedURLPatientDemographic=http://test-patient-demographic-url-for-swagger +abdmFacilityId=sample-facility-id-for-swagger +generateOTPForCareContext=http://test-otp-for-care-context-for-swagger +validateOTPForCareContext=http://test-validate-otp-for-care-context-for-swagger +addCareContext=http://test-add-care-context-for-swagger +getAbdmFacilityServicies=http://test-get-abdm-facility-services-for-swagger +atomFeedURLPatientEncounter=http://test-atom-feed-patient-encounter +atomFeedURLPatientClinical=http://test-atom-feed-patient-clinical +# --- Additional required properties for Swagger profile (placeholder values) --- cors.allowed-origins=http://localhost:8080 -jwt.secret=dummy-jwt-secret -eaushadhiStoreStockDetailsUrl=http://dummy-eaushadhi-details-url -eaushadhiStoreStockAckUrl=http://dummy-eaushadhi-ack-url -eAushadhiDummy=dummy-eaushadhi -benSearchByBenIDURL=http://dummy-ben-search-url -userAuthURL=http://dummy-user-auth-url -fhirUserName=dummy-fhir-username -fhirPassword=dummy-fhir-password -abhaMode=dummy-abha-mode -clientID=dummy-client-id -clientSecret=dummy-client-secret -ndhmuserAuthenticate=dummy-ndhm-auth -generateABDM_NotifySMS=dummy-abdm-notify-sms +jwt.secret=sample-jwt-secret +eaushadhiStoreStockDetailsUrl=http://test-eaushadhi-details-url +eaushadhiStoreStockAckUrl=http://test-eaushadhi-ack-url +eAushadhiDummy=sample-eaushadhi +benSearchByBenIDURL=http://test-ben-search-url +userAuthURL=http://test-user-auth-url +fhirUserName=sample-fhir-username +fhirPassword=sample-fhir-password +abhaMode=sample-abha-mode +clientID=sample-client-id +clientSecret=sample-client-secret +ndhmuserAuthenticate=sample-ndhm-auth +generateABDM_NotifySMS=sample-abdm-notify-sms atomsFeedStartPage=1 -webLoginAbhaRequestOtp=dummy-web-login-abha-request-otp -webLoginAbhaVerify=dummy-web-login-abha-verify -verifyAbhaLogin=dummy-verify-abha-login -abhaLoginRequestOtp=dummy-abha-login-request-otp -abhaProfileLoginVerifyUser=dummy-abha-profile-login-verify-user -webLoginPhrCard=dummy-web-login-phr-card -requestOtpForEnrollment=dummy-request-otp-for-enrollment -requestAuthByAbdm=dummy-request-auth-by-abdm -abhaEnrollByAadhaar=dummy-abha-enroll-by-aadhaar -printAbhaCard=dummy-print-abha-card -getAuthCertPublicKey=dummy-auth-cert-public-key +webLoginAbhaRequestOtp=sample-web-login-abha-request-otp +webLoginAbhaVerify=sample-web-login-abha-verify +verifyAbhaLogin=sample-verify-abha-login +abhaLoginRequestOtp=sample-abha-login-request-otp +abhaProfileLoginVerifyUser=sample-abha-profile-login-verify-user +webLoginPhrCard=sample-web-login-phr-card +requestOtpForEnrollment=sample-request-otp-for-enrollment +requestAuthByAbdm=sample-request-auth-by-abdm +abhaEnrollByAadhaar=sample-abha-enroll-by-aadhaar +printAbhaCard=sample-print-abha-card +getAuthCertPublicKey=sample-auth-cert-public-key eAushadhiDispensePageSize=10 patient-search-page-size=10 -generateOTPForCareContext=dummy-generate-otp-for-care-context -validateOTPForCareContext=dummy-validate-otp-for-care-context -addCareContext=dummy-add-care-context -getAbdmFacilityServicies=dummy-get-abdm-facility-services -nhm.agent.real.time.data.url=dummy-nhm-agent-url +generateOTPForCareContext=sample-generate-otp-for-care-context +validateOTPForCareContext=sample-validate-otp-for-care-context +addCareContext=sample-add-care-context +getAbdmFacilityServicies=sample-get-abdm-facility-services +nhm.agent.real.time.data.url=sample-nhm-agent-url everwellCalendarDuration=10 callRetryConfiguration=3 -sms-username=dummy-sms-username -sms-password=dummy-sms-password -sms-entityid=dummy-sms-entityid -sms-consent-source-address=dummy-sms-consent-source-address -send-message-url=dummy-send-message-url +sms-username=sample-sms-username +sms-password=sample-sms-password +sms-entityid=sample-sms-entityid +sms-consent-source-address=sample-sms-consent-source-address +send-message-url=sample-send-message-url calibrationPageSize=10 iemr.session.expiry.time.sec=3600 \ No newline at end of file From 684549a891bf318d51dcb4a75f1977a63d776373 Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Wed, 4 Feb 2026 12:09:57 +0530 Subject: [PATCH 5/8] chore(swagger): automate swagger sync to amrit-docs --- .github/workflows/swagger-json.yml | 33 ++++++++++++------------------ 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/.github/workflows/swagger-json.yml b/.github/workflows/swagger-json.yml index b1df7a2..1d23682 100644 --- a/.github/workflows/swagger-json.yml +++ b/.github/workflows/swagger-json.yml @@ -11,12 +11,12 @@ jobs: steps: - name: Checkout API repo - # Pin to commit SHA for actions/checkout v4.1.0 - uses: actions/checkout@caa6c9e2e6b4e4e3e7e6e6e6e6e6e6e6e6e6e6e6 + uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up Java 17 - # Pin to commit SHA for actions/setup-java v4.2.1 - uses: actions/setup-java@a9b4c8e2e6b4e4e3e7e6e6e6e6e6e6e6e6e6e6e6 + uses: actions/setup-java@v4 with: distribution: temurin java-version: 17 @@ -38,16 +38,12 @@ jobs: - name: Wait for API & fetch Swagger run: | - for i in {1..30}; do + for i in {1..20}; do CODE=$(curl --connect-timeout 2 --max-time 5 -s -o swagger_raw.json -w "%{http_code}" http://localhost:9090/v3/api-docs || true) if [ "$CODE" = "200" ]; then - if jq . swagger_raw.json > fhir-api.json; then - echo "Swagger generated successfully" - exit 0 - else - echo "Failed to parse swagger_raw.json with jq" - exit 1 - fi + jq . swagger_raw.json > fhir-api.json + echo "Swagger generated" + exit 0 fi echo "Waiting for API... ($i)" sleep 5 @@ -65,8 +61,7 @@ jobs: fi - name: Checkout AMRIT-Docs - # Pin to commit SHA for actions/checkout v4.1.0 - uses: actions/checkout@caa6c9e2e6b4e4e3e7e6e6e6e6e6e6e6e6e6e6e6 + uses: actions/checkout@v4 with: repository: PSMRI/AMRIT-Docs token: ${{ secrets.DOCS_REPO_TOKEN }} @@ -78,15 +73,13 @@ jobs: cp fhir-api.json amrit-docs/docs/swagger/fhir-api.json - name: Create Pull Request - # Pin to commit SHA for peter-evans/create-pull-request v6.0.2 - uses: peter-evans/create-pull-request@e7e6e6e6e6e6e6e6e6e6e6e6e6e6e6e6e6e6e6e6 + uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.DOCS_REPO_TOKEN }} path: amrit-docs branch: auto/swagger-update-${{ github.run_id }} base: main - commit-message: Auto-update FHIR-API swagger - title: Auto-update FHIR-API swagger + commit-message: "docs(swagger): auto-update FHIR-API" + title: "docs(swagger): auto-update FHIR-API" body: | - This PR automatically updates the FHIR-API Swagger JSON - from the latest main branch build. + Automated Swagger sync from FHIR-API main branch. From 3d12da0bdab1157362196b16c5764f51c7a6189b Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Wed, 4 Feb 2026 12:19:29 +0530 Subject: [PATCH 6/8] chore(swagger): automate swagger sync to amrit-docs --- .github/workflows/swagger-json.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/swagger-json.yml b/.github/workflows/swagger-json.yml index 1d23682..540bcf9 100644 --- a/.github/workflows/swagger-json.yml +++ b/.github/workflows/swagger-json.yml @@ -1,5 +1,12 @@ name: Sync Swagger to AMRIT-Docs +permissions: + contents: write + pull-requests: write + id-token: none + packages: none + checks: none + on: push: branches: [ main ] From 92d37530ab7a716a2da8158bd607ca936e01f7fa Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Wed, 11 Feb 2026 10:25:20 +0530 Subject: [PATCH 7/8] fix(swagger): remove duplicate from properties and update swagger workflow --- .github/workflows/swagger-json.yml | 65 ++++++++++++------- .../resources/application-swagger.properties | 51 ++++----------- 2 files changed, 52 insertions(+), 64 deletions(-) diff --git a/.github/workflows/swagger-json.yml b/.github/workflows/swagger-json.yml index 540bcf9..d140252 100644 --- a/.github/workflows/swagger-json.yml +++ b/.github/workflows/swagger-json.yml @@ -1,12 +1,5 @@ name: Sync Swagger to AMRIT-Docs -permissions: - contents: write - pull-requests: write - id-token: none - packages: none - checks: none - on: push: branches: [ main ] @@ -15,12 +8,11 @@ on: jobs: swagger-sync: runs-on: ubuntu-latest + timeout-minutes: 20 steps: - name: Checkout API repo uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Set up Java 17 uses: actions/setup-java@v4 @@ -30,30 +22,42 @@ jobs: cache: maven - name: Build API (skip tests) - run: mvn clean package -DskipTests - + run: mvn -B clean package -DskipTests + - name: Install jq run: sudo apt-get update && sudo apt-get install -y jq - name: Run API in swagger profile run: | - mvn spring-boot:run \ - -Dspring-boot.run.profiles=swagger \ - -Dspring-boot.run.arguments=--server.port=9090 \ + nohup java -jar target/fhir-api-*.war \ + --spring.profiles.active=swagger \ + --server.port=9090 \ > app.log 2>&1 & echo $! > api_pid.txt - name: Wait for API & fetch Swagger run: | - for i in {1..20}; do + for i in {1..40}; do CODE=$(curl --connect-timeout 2 --max-time 5 -s -o swagger_raw.json -w "%{http_code}" http://localhost:9090/v3/api-docs || true) + if [ "$CODE" = "200" ]; then - jq . swagger_raw.json > fhir-api.json - echo "Swagger generated" + jq . swagger_raw.json > fhir-api.json || { + echo "Swagger JSON invalid" + cat swagger_raw.json + exit 1 + } + + if [ "$(jq '.paths | length' fhir-api.json)" -eq 0 ]; then + echo "Swagger paths empty – failing" + exit 1 + fi + + echo "Swagger generated successfully" exit 0 fi + echo "Waiting for API... ($i)" - sleep 5 + sleep 4 done echo "Swagger not generated" @@ -63,9 +67,17 @@ jobs: - name: Stop API if: always() run: | + # Graceful shutdown of the process group + sleep 5 + # Force kill the process group if still running if [ -f api_pid.txt ]; then - kill $(cat api_pid.txt) || true - fi + PID=$(cat api_pid.txt) + kill -TERM -- -"$PID" 2>/dev/null || true + sleep 2 + kill -9 -- -"$PID" 2>/dev/null || true + fi + # Fallback: kill any remaining java process on port 9090 + fuser -k 9090/tcp 2>/dev/null || true - name: Checkout AMRIT-Docs uses: actions/checkout@v4 @@ -73,6 +85,7 @@ jobs: repository: PSMRI/AMRIT-Docs token: ${{ secrets.DOCS_REPO_TOKEN }} path: amrit-docs + fetch-depth: 0 - name: Copy Swagger JSON run: | @@ -80,13 +93,15 @@ jobs: cp fhir-api.json amrit-docs/docs/swagger/fhir-api.json - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 + uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.DOCS_REPO_TOKEN }} path: amrit-docs - branch: auto/swagger-update-${{ github.run_id }} + branch: auto/swagger-update-${{ github.run_id }}-${{ github.run_attempt }} base: main - commit-message: "docs(swagger): auto-update FHIR-API" - title: "docs(swagger): auto-update FHIR-API" + commit-message: "chore(docs): auto-update FHIR-API swagger" + title: "chore(docs): auto-update FHIR-API swagger" + delete-branch: true body: | - Automated Swagger sync from FHIR-API main branch. + This PR automatically updates FHIR-API Swagger JSON + from the latest main branch build. diff --git a/src/main/resources/application-swagger.properties b/src/main/resources/application-swagger.properties index 1639281..ce50e62 100644 --- a/src/main/resources/application-swagger.properties +++ b/src/main/resources/application-swagger.properties @@ -81,42 +81,8 @@ spring.jpa.hibernate.ddl-auto=none spring.redis.host=localhost spring.redis.port=6379 -# CORS for Swagger UI -cors.allowed-origins=${CORS_ALLOWED_ORIGINS:http://localhost:9090,http://localhost:8080} - -# Logging -logging.level.root=INFO - -# Disable security auto-configuration (already excluded in main class) -# If you have custom security beans, add @Profile("!swagger") to them - -jwt.secret=JWT_SECRET -eaushadhiStoreStockDetailsUrl=http://test-url-for-swagger -eaushadhiStoreStockAckUrl=http://test-url-for-swagger -eAushadhiDummy=sample-value-for-swagger -benSearchByBenIDURL=http://test-url-for-swagger -userAuthURL=http://test-url-for-swagger -fhirUserName=sample-username-for-swagger -fhirPassword=sample-password-for-swagger -abhaMode=http://test-abha-mode-for-swagger -clientID=sample-client-id-for-swagger -clientSecret=sample-client-secret-for-swagger -ndhmuserAuthenticate=http://test-ndhm-auth-for-swagger -generateABDM_NotifySMS=http://test-abdm-sms-for-swagger -atomsFeedStartPage=1 -feedAuthUserName=sample-feed-auth-username -feedAuthPassword=sample-feed-auth-password -parentUrl=http://test-parent-url-for-swagger -atomFeedURLPatientDemographic=http://test-patient-demographic-url-for-swagger -abdmFacilityId=sample-facility-id-for-swagger -generateOTPForCareContext=http://test-otp-for-care-context-for-swagger -validateOTPForCareContext=http://test-validate-otp-for-care-context-for-swagger -addCareContext=http://test-add-care-context-for-swagger -getAbdmFacilityServicies=http://test-get-abdm-facility-services-for-swagger -atomFeedURLPatientEncounter=http://test-atom-feed-patient-encounter -atomFeedURLPatientClinical=http://test-atom-feed-patient-clinical -# --- Additional required properties for Swagger profile (placeholder values) --- cors.allowed-origins=http://localhost:8080 +logging.level.root=INFO jwt.secret=sample-jwt-secret eaushadhiStoreStockDetailsUrl=http://test-eaushadhi-details-url eaushadhiStoreStockAckUrl=http://test-eaushadhi-ack-url @@ -131,6 +97,17 @@ clientSecret=sample-client-secret ndhmuserAuthenticate=sample-ndhm-auth generateABDM_NotifySMS=sample-abdm-notify-sms atomsFeedStartPage=1 +feedAuthUserName=sample-feed-auth-username +feedAuthPassword=sample-feed-auth-password +parentUrl=http://test-parent-url-for-swagger +atomFeedURLPatientDemographic=http://test-patient-demographic-url-for-swagger +abdmFacilityId=sample-facility-id-for-swagger +generateOTPForCareContext=sample-generate-otp-for-care-context +validateOTPForCareContext=sample-validate-otp-for-care-context +addCareContext=sample-add-care-context +getAbdmFacilityServicies=sample-get-abdm-facility-services +atomFeedURLPatientEncounter=http://test-atom-feed-patient-encounter +atomFeedURLPatientClinical=http://test-atom-feed-patient-clinical webLoginAbhaRequestOtp=sample-web-login-abha-request-otp webLoginAbhaVerify=sample-web-login-abha-verify verifyAbhaLogin=sample-verify-abha-login @@ -144,10 +121,6 @@ printAbhaCard=sample-print-abha-card getAuthCertPublicKey=sample-auth-cert-public-key eAushadhiDispensePageSize=10 patient-search-page-size=10 -generateOTPForCareContext=sample-generate-otp-for-care-context -validateOTPForCareContext=sample-validate-otp-for-care-context -addCareContext=sample-add-care-context -getAbdmFacilityServicies=sample-get-abdm-facility-services nhm.agent.real.time.data.url=sample-nhm-agent-url everwellCalendarDuration=10 callRetryConfiguration=3 From 14b80a3cae3b2a7ef9a4972134408088abac772a Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Thu, 12 Feb 2026 15:02:49 +0530 Subject: [PATCH 8/8] chore(swagger): add env-driven Dev/UAT/Demo servers and update workflow --- .github/workflows/swagger-json.yml | 2 +- .../com/wipro/fhir/config/SwaggerConfig.java | 26 +++++++++++++------ .../resources/application-swagger.properties | 4 +++ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/swagger-json.yml b/.github/workflows/swagger-json.yml index d140252..38b460d 100644 --- a/.github/workflows/swagger-json.yml +++ b/.github/workflows/swagger-json.yml @@ -97,7 +97,7 @@ jobs: with: token: ${{ secrets.DOCS_REPO_TOKEN }} path: amrit-docs - branch: auto/swagger-update-${{ github.run_id }}-${{ github.run_attempt }} + branch: auto/swagger-update-fhir-api base: main commit-message: "chore(docs): auto-update FHIR-API swagger" title: "chore(docs): auto-update FHIR-API swagger" diff --git a/src/main/java/com/wipro/fhir/config/SwaggerConfig.java b/src/main/java/com/wipro/fhir/config/SwaggerConfig.java index d04aff6..feaab55 100644 --- a/src/main/java/com/wipro/fhir/config/SwaggerConfig.java +++ b/src/main/java/com/wipro/fhir/config/SwaggerConfig.java @@ -2,6 +2,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; @@ -11,14 +12,23 @@ @Configuration public class SwaggerConfig { - - @Bean - public OpenAPI customOpenAPI() { - return new OpenAPI().info(new - Info().title("FHIR API").version("version").description("A microservice for the creation and management of beneficiaries.")) - .addSecurityItem(new SecurityRequirement().addList("my security")) - .components(new Components().addSecuritySchemes("my security", - new SecurityScheme().name("my security").type(SecurityScheme.Type.HTTP).scheme("bearer"))); + private static final String DEFAULT_SERVER_URL = "http://localhost:9090"; + + @Bean + public OpenAPI customOpenAPI(Environment env) { + String devUrl = env.getProperty("api.dev.url", DEFAULT_SERVER_URL); + String uatUrl = env.getProperty("api.uat.url", DEFAULT_SERVER_URL); + String demoUrl = env.getProperty("api.demo.url", DEFAULT_SERVER_URL); + return new OpenAPI() + .info(new Info().title("FHIR API").version("version").description("A microservice for the creation and management of beneficiaries.")) + .addSecurityItem(new SecurityRequirement().addList("my security")) + .components(new Components().addSecuritySchemes("my security", + new SecurityScheme().name("my security").type(SecurityScheme.Type.HTTP).scheme("bearer"))) + .servers(java.util.Arrays.asList( + new io.swagger.v3.oas.models.servers.Server().url(devUrl).description("Dev"), + new io.swagger.v3.oas.models.servers.Server().url(uatUrl).description("UAT"), + new io.swagger.v3.oas.models.servers.Server().url(demoUrl).description("Demo") + )); } } diff --git a/src/main/resources/application-swagger.properties b/src/main/resources/application-swagger.properties index ce50e62..8a365d1 100644 --- a/src/main/resources/application-swagger.properties +++ b/src/main/resources/application-swagger.properties @@ -1,3 +1,7 @@ +# Swagger server URLs +api.dev.url=${API_DEV_URL:https://amritwprdev.piramalswasthya.org} +api.uat.url=${API_UAT_URL:https://uatamrit.piramalswasthya.org} +api.demo.url=${API_DEMO_URL:https://amritdemo.piramalswasthya.org} ndhmCreateHealthID=placeholder # --- Swagger Profile Dummy Properties --- # Database