-
Notifications
You must be signed in to change notification settings - Fork 46
feat(#10221): add documentation to create and update person, place and report #1962
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
base: main
Are you sure you want to change the base?
feat(#10221): add documentation to create and update person, place and report #1962
Conversation
de913a3 to
77fca3c
Compare
sugat009
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Can you add all the endpoints in this PR?
| ``` | ||
|
|
||
| ### POST /api/v1/person | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: add a "added in X.X.X" version note for all the endpoints
| ``` | ||
|
|
||
| ### POST /api/v1/person | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: add the description of the endpoint
content/en/building/reference/api.md
Outdated
| Either of the two: | ||
| 1. `can_edit` | ||
| 2. `can_view_contacts` and `can_create_people` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Either of the two: | |
| 1. `can_edit` | |
| 2. `can_view_contacts` and `can_create_people` | |
| Should have `can_edit` or both `can_view_contacts` and `can_create_people` |
The wording seemed a bit confusing to me.
content/en/building/reference/api.md
Outdated
| | Key | Description | | ||
| | ---- | ----------------------------------- | | ||
| | name | String used to describe the person. | | ||
| | type | ID of the `contact_type` for the new person. Pass in `person` for older versions. | | ||
| | parent | ID of the parent document, which is a place, for the new person. The type of the parent must belong to one of the allowed `parents` for the `contact_type` id in the settings config. | | ||
|
|
||
| #### Optional | ||
|
|
||
| | Key | Description | | ||
| | ------------- | ---------------------------------------------------------------------- | | ||
| | reported_date | Timestamp of when the record was reported or created. Defaults to now. | | ||
| | _id | ID of the new person document to be created. | | ||
| | short_name | String to denote short name of the person. | | ||
| | phone | Phone number of the person in string format. | | ||
| | role | Role of the person in string format. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: let's use fields instead of key here
content/en/building/reference/api.md
Outdated
| #### Required | ||
| | Key | Description | | ||
| | ---- | ----------------------------------- | | ||
| | name | String used to describe the person. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| | name | String used to describe the person. | | |
| | name | Name of the person. | |
content/en/building/reference/api.md
Outdated
| | Key | Description | | ||
| | ------------- | ---------------------------------------------------------------------- | | ||
| | reported_date | Timestamp of when the record was reported or created. Defaults to now. | | ||
| | _id | ID of the new person document to be created. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| | _id | ID of the new person document to be created. | | |
| | _id | ID of the new person document to be created in UUID format. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: how about adding another column that contains the type of the field instead of doing a "... string format" in the description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm makes sense.
content/en/building/reference/api.md
Outdated
| "contact_type": "person" | ||
| } | ||
| ``` | ||
| ### PUT /api/v1/person |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ### PUT /api/v1/person | |
| ### PUT /api/v1/person |
content/en/building/reference/api.md
Outdated
| | reported_date | Timestamp of when the record was reported or created. | | ||
| | contact_type| Required if the type of the person is `contact`. | | ||
| | type | The type of the person. | | ||
| | parent | The parent lineage of the person to be updated, can be hydrated or dehydrated. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: parent cannot be updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be helpful to document why parent cannot be updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant "person to be updated"'s parent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohhh, my bad. I misread this.
Signed-off-by: apoorvapendse <[email protected]>
77fca3c to
01752bd
Compare
Signed-off-by: Apoorva Pendse <[email protected]>
3bdce51 to
f5429a0
Compare
Signed-off-by: apoorvapendse <[email protected]>
f5429a0 to
ab7235b
Compare
Signed-off-by: apoorvapendse <[email protected]>
content/en/building/reference/api.md
Outdated
|
|
||
| ### POST /api/v1/person | ||
|
|
||
| *Added in x.x.x* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now you can add the version as 5.0.0. If something changes, it can be changed.
content/en/building/reference/api.md
Outdated
| #### Permissions | ||
| Either of the two: | ||
| 1. `can_edit` | ||
| 2. `can_view_contacts` and `can_update_people` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: make the same changes as above in this section as well
content/en/building/reference/api.md
Outdated
| | parent | The parent lineage of the place to be updated. Not required if the place is at the top of the hierarchy. | Minified or hydrated parent lineage | | ||
| | contact | The contact lineage linked with the place. This can be inserted as a part of update if not already present. | Minified or hydrated lineage | | ||
|
|
||
| ### Required mutable fields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ### Required mutable fields | |
| #### Required mutable fields |
content/en/building/reference/api.md
Outdated
| | Field | Description | Format | | ||
| | ---- | ----------------------------------- | -------- | | ||
| | name | Name of the person. | string | | ||
| | type | ID of the `contact_type` for the new person. Pass in `person` for older versions. | string | | ||
| | parent | ID of the parent document, which is a place, for the new person. The type of the parent must belong to one of the allowed `parents` for the `contact_type` id in the settings config. | UUID string | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: if there is an option to format these tables in your editor, then please do so. For reference check the GET API's table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍
Co-authored-by: Sugat Bajracharya <[email protected]>
Signed-off-by: Apoorva Pendse <[email protected]>
sugat009
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I'll merge this once the release version for medic/cht-core#9835 is finalized.
Signed-off-by: Apoorva Pendse <[email protected]>
Signed-off-by: Apoorva Pendse <[email protected]>



Addresses: medic/cht-core#10221.
Description
WIP documentation updates to add
POST /api/v1/personandPUT /api/v1/personendpoints[description]
POST /api/v1/personPUT /api/v1/personLicense
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.