Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add api to get approval statuses #1576

Closed
Tracked by #1579
siddhant3030 opened this issue Apr 17, 2024 · 5 comments
Closed
Tracked by #1579

Add api to get approval statuses #1576

siddhant3030 opened this issue Apr 17, 2024 · 5 comments
Assignees

Comments

@siddhant3030
Copy link

siddhant3030 commented Apr 17, 2024

Need:

For integrations like Dalgo, which use APIs to fetch data, they are unable to differentiate the data based on approval status

AC:

api: GET /api/approvalStatuses
params allowed:

now, lastModifiedDateTime - purpose: to filter based on time
entityType, entityTypeUuid - purpose: to filter based on a entity type 
locationUuids - uuids of the location  - purpose: to filter based on the uuids mentioned here(It implies the need to filter based on the child locations of the uuids mentioned here)

Response Body:

{
  "content": [
    {
      "Entity uuid": "uuid of the entity say encounter",
      "Entity type": "Encounter",
      "Entity type uuid": "uuid of the encounter type",
      "Approval status": "Rejected",
      "Approval status comment": "Duplicate",
      "Auto approved": false,
      "Status date time": "2023-11-14T10:20:06.457Z",
      "Audit": {
        "Created at": "2023-11-14T10:20:06.457Z",
        "Last modified at": "2023-11-14T10:20:06.457Z",
        "Created by": "nupoork@iph_ctrith_uat",
        "Last modified by": "nupoork@iph_ctrith_uat"
      }
    },
    ...
  ],
  "totalElements": 20,
  "totalPages": 13,
  "pageSize": 20
}
  • All the above mentioned parameters are optional. Filter based on it if present.
  • Check for privilege for the approval of the corresponding entity type. Eg: If entity type is 'Encounter' user need to have privilege of 'Approve Encounter' for the corresponding entityTypeUuids. If not present, then return the error User doesn't have privilege of type: Approve Encounter for encounter type with uuid 'abcd-efgh'
  • For value of Approval status field directly mention the value instead of uuid
  • Also return totalElements, totalPages, pageSize
  • For anything not mentioned above, the behaviour need to be similar to other apis.
  • Update API readme - swagger documentation with details.
  • Note the purpose mentioned for each params and filter accordingly.
  • Note the release no marked in the card.

Reasons behind some analysis decisions:

  • Previously in apis like /api/subjects - though the name of the field will say id, value will be uuid. Felt its better to have the name of the field as well as uuid, since CSVs(going to come in near future) and webapp UI have this uuid in the UI
  • request params field names in snake case, and response field names in title case - since this is what is tried to be followed so far.
  • Have structured the AC similar to other apis already present for consistency reasons.
@mahalakshme mahalakshme changed the title Approval status is not in the api Add approval status to GET of entities. Apr 18, 2024
@avniproject avniproject deleted a comment from mahalakshme Apr 18, 2024
@mahalakshme mahalakshme changed the title Add approval status to GET of entities. Add api to get approval statuses Apr 19, 2024
@1t5j0y 1t5j0y self-assigned this Apr 19, 2024
@mahalakshme
Copy link

@1t5j0y if locationUuids parameter support is not yet added, that need not be done now as part of this card. If its already done, thats also is fine.

1t5j0y added a commit to avniproject/avni-server that referenced this issue Apr 23, 2024
1t5j0y added a commit to avniproject/avni-server that referenced this issue Apr 24, 2024
@1t5j0y
Copy link

1t5j0y commented Apr 24, 2024

Changes from AC to maintain consistency with other APIs:

  • request parameter entityTypeUuid renamed to entityTypeId
  • response element "Entity uuid" renamed to "Entity ID"
  • response element "Entity type uuid" renamed to "Entity type ID"

@petmongrels
Copy link

The reason behind use of ID instead of UUID is to not expose internal id to external system. So for the user of api, uuid is the id.

@AchalaBelokar
Copy link

AchalaBelokar commented Apr 25, 2024

  • tested with AchalaB@rwbnitiuat which is having all access
  • tested for encounter type with user having all access
  • if user doesn’t have privileges then it is not showing the response
  • checked with program enrolment
  • checked with program encounter

@AchalaBelokar
Copy link

AchalaBelokar commented May 16, 2024

  • tested location api with and without lastModifedDateTime
  • tested approval status api with subject type program encounter
  • download the apk with circle ci and tested with achala@achala@rwb24stag
  • [] there is filter which is not working for daily recording farmer and machine
    Record_2024-05-16-15-50-58.mp4.zip
    others are working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

6 participants