Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions .github/workflows/swagger-json.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Sync Swagger to AMRIT-Docs

on:
push:
branches: [ main ]
workflow_dispatch:

jobs:
swagger-sync:
runs-on: ubuntu-latest

Comment thread
coderabbitai[bot] marked this conversation as resolved.
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
Comment thread
coderabbitai[bot] marked this conversation as resolved.
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.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@
<version>0.12.6</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>


</dependencies>
Expand Down
172 changes: 172 additions & 0 deletions src/main/resources/application-swagger.properties
Original file line number Diff line number Diff line change
@@ -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=*

Comment thread
coderabbitai[bot] marked this conversation as resolved.
# 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
Comment thread
coderabbitai[bot] marked this conversation as resolved.
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
Loading