File tree Expand file tree Collapse file tree 5 files changed +76
-13
lines changed
Expand file tree Collapse file tree 5 files changed +76
-13
lines changed Original file line number Diff line number Diff line change 1+ name : Docker Build and Deploy
2+
3+ on :
4+ push :
5+ branches :
6+ - main # Trigger on pushes to the main branch
7+
8+ jobs :
9+ build-and-run :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout Repository
14+ uses : actions/checkout@v3
15+
16+ - name : Set up Docker
17+ uses : docker/setup-buildx-action@v3
18+
19+ - name : Build Docker Image
20+ run : docker build -t custom-sql-server -f docker/mssql.Dockerfile .
21+
22+ - name : Push Docker Image (Optional)
23+ env :
24+ DOCKER_USER : ${{ secrets.DOCKER_USERNAME }}
25+ DOCKER_PASS : ${{ secrets.DOCKER_PASSWORD }}
26+ run : |
27+ echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
28+ docker tag custom-sql-server username/custom-sql-server:latest
29+ docker push username/custom-sql-server:latest
30+
31+ - name : Run Docker Container
32+ run : |
33+ docker stop my-custom-sql-server || true
34+ docker rm my-custom-sql-server || true
35+ docker run -d --name my-custom-sql-server -p 1433:1433 custom-sql-server
Original file line number Diff line number Diff line change 5353 ]
5454}
5555
56+ # Extracting maximum claim amount for each patient
57+ max_claims = {}
58+ for patient in raw_data ['patients' ]:
59+ patient_id = patient ['patient_id' ]
60+ max_claim = max (claim ['claim_amount' ] for claim in patient ['claims' ])
61+ max_claims [patient_id ] = max_claim
5662
57- def search_json (data , key ):
58- for i in data :
59- print (type (i ), i )
60- print (type (data [i ]), data [i ])
61- if data [i ] is list :
62- for j in data [i ]:
63- print (type (j ), j )
64- print (type (j [i ]), j [i ])
65- if j [i ] == key :
66- return j
67- else :
68- return search_json (j , key )
63+ print (max_claims )
6964
7065
71- print (search_json (raw_data , 'P001' ))
66+ patient_input = 'P002'
67+ max_claim = None
68+ for patient in raw_data ['patients' ]:
69+ if patient ['patient_id' ] == patient_input :
70+ max_claim = max (claim ['claim_amount' ] for claim in patient ['claims' ])
71+ break
72+
73+ print (f"Maximum claim amount for patient { patient_input } : { max_claim } " )
Original file line number Diff line number Diff line change 1+ # Use the official SQL Server 2022 image as the base image
2+ FROM mcr.microsoft.com/mssql/server:2022-latest
3+
4+ # Set environment variables
5+ ENV ACCEPT_EULA=Y
6+ ENV MSSQL_SA_PASSWORD=YourStrong@Passw0rd
7+ # Change to Developer/Standard/Enterprise if needed
8+ ENV MSSQL_PID=Developer
9+
10+ # Expose the SQL Server port
11+ EXPOSE 1433
12+
13+ # Start SQL Server when the container starts
14+ CMD ["/opt/mssql/bin/sqlservr" ]
Original file line number Diff line number Diff line change 1+ inp = [1 ,2 ,3 ,4 ]
2+ sq = [16 ,1 ,9 ,4 ]
3+
4+ for i in inp :
5+ if i ** 2 in sq :
6+ print (i ,"present" )
7+ else :
8+ print (i ,"not present" )
Original file line number Diff line number Diff line change 1+ l = [3 ,5 ,2 ,9 ,8 ,1 ]
2+
3+ l = sorted (l , reverse = True )
4+ print (l [2 ])
You can’t perform that action at this time.
0 commit comments