User Story 1: As a MapHabit Community Manager, I can link my PCC credentials to my MapHabit account.
To create/update a relationship between the Maphabit user and the PCC user, make the following request:
curl -X PATCH \
"https://api-staging.middleware.maphabit.com/v1/mh/community/community123/user/123/rel/pccUser" \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer token" \
-d '{ \
"data": { \
"type": "PCCRelationship", \
"id": "pccOrgUUID.pccUserId" \
} \
}'
To create/update a relationship between a Maphabit community and a PCC facility, make the following request:
curl -X PATCH \
"https://api-staging.middleware.maphabit.com/v1/mh/community/community123/rel/pccFac" \
-H "accept: application/json" \
-H "Authorization: Bearer token" \
-H "Content-Type: application/json" \
-d '{
"data":{ \
"type": "PCCRelationship", \
"id": "pccOrgUuid.pccFacId" \
} \
}''
curl -X GET "https://api-staging.middleware.maphabit.com/v1/mh/community/community123/user/1/rel/pccUser" \
-H "accept: application/json" \
-H "Authorization: Bearer token"
curl -X GET "https://api-staging.middleware.maphabit.com/v1/mh/community/community123/rel/pccFac" \
-H "accept: application/json" \
-H "Authorization: Bearer token"
User Story 3: As an anonymous visitor, I can use my PCC credentials to login to MapHabit.
To get a list of all the Maphabit users that are linked to the provided PCC user credentials, make the following request:
curl -X GET \
"https://api-staging.middleware.maphabit.com/v1/pcc/org/<orgUuid>/user/<pccUserId>/rel/mhUser" \
-H "accept: application/json" \
-H "Authorization: Bearer token"
User Story 4: As a MapHabit community manager, I can remove previously established link to a PCC user.
curl -X PATCH \
https://api-staging.middleware.maphabit.com/v1/mh/community/community123/user/123/rel/pccUser \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer token" \
-d '{"data": null}'
To delete a relationship between a PCC Facility and a Maphabit Community, make the following request:
curl -X PATCH \
"https://api-staging.middleware.maphabit.com/v1/mh/community/community123/rel/pccFac" \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer token" \
-d '{"data": null}'
User Story 5: As MH community manager with linked PCC account, I can view the list of PCC patients in the PCC facility to which I have access.
curl -G \
"http://127.0.0.1:5000/v1/pcc/org/1D56E037-24C5-409F-A414-C9718B519300/patient" \
-d filter['facId']=12 \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer token"
curl -G \
"http://127.0.0.1:5000/v1/pcc/org/1D56E037-24C5-409F-A414-C9718B519300/patient" \
-d filter['facId']=12 \
-d page['number']=2 \
-d page['size']=200 \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer token"
Note: PCC does not provide the total number of records available. While paging, the last page of records will have no "next" link.
User Story 6: As MH community manager with linked PCC account, I can create a MapHabit Resident from a PCC patient.
After the user chooses a PCC patient, get the PCC patient data to create a resident from (user should provide additional data attributes):
curl -X GET \
"https://api-staging.middleware.maphabit.com/v1/pcc/org/pccOrgUUID/patient/patientID" \
-H "accept: application/json" \
-H "Authorization: Bearer token"
Then, create a MH resident from the PCC patient data + user provided data with the following request:
curl -X POST \
"https://api-staging.middleware.maphabit.com/v1/mh/community/community123/user" \
-H "accept: application/json" \
-H "Authorization: Bearer token" \
-H "Content-Type: application/json" \
-d '{ \
"data": { \
"id": "1D56E037-24C5-409F-A414-C9718B519300.6209", \
"type": "PCCPatient", \
"attributes": { \
"birthDate": "1953-11-25", \
"facId": 12, \
"firstName": "Shari", \
"gender": "FEMALE", \
"lastName": "Abreu", \
"orgUuid": "1D56E037-24C5-409F-A414-C9718B519300", \
"roomId": 1158, \
...
}, \
} \
}'
User Story 7: As a MH community manager with a linked PCC account, I can link an existing MapHabit Resident to a PCC Patient.
curl -X PATCH \
"https://api-staging.middleware.maphabit.com/v1/mh/community/communty123/user/1/rel/pccPatient" \
-H "accept: application/json"
-H "Authorization: Bearer token"
-H "Content-Type: application/json"
-d '{ \
"data": { \
"type": "PCCRelationship", \
"id": "pccOrgUuid.pccUserId" \
} \
}'
curl -X GET "https://api-staging.middleware.maphabit.com/v1/mh/community/community123/user/1/rel/pccPatient" \
-H "accept: application/json" \
-H "Authorization: Bearer token"
User Story 8: As a MH community manager with linked a PCC account, I can unlink an existing MapHabit Resident from a PCC Patient.
curl -X PATCH \
https://api-staging.middleware.maphabit.com/v1/mh/community/community123/user/1/rel/pccPatient \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer token" \
-d '{"data": null}'
User Story 9 & 10: As a MH community manager with a linked PCC account, I can synchronize all of the patients at a PCC facility to my community.
curl -X PATCH \
"https://api-staging.middleware.maphabit.com/v1/mh/community/community123" \
-H "accept: application/json" \
-H "Authorization: Bearer token" \
-H "Content-Type: application/json" \
-d '{ \
"data": { \
"type": "MHCommunity", \
"id": "communityId", \
"attributes": { \
"autosync": boolean \
} \
} \
}'