serenity-health / roadmap

Public roadmap for development of Serenity's apps reported by our community of users
0 stars 1 forks source link

feature/set up revenue tags for reporting #101

Open chris-dare opened 2 years ago

chris-dare commented 2 years ago

Tell us about your request! Providers need set the custom categories for their services and products. We can acheive this with revenue tags

Which app does this concern? Provider portal

What will be benefit of this feature? Revenue tags will help providers report on their bills the way they like

Describe the solution you'd like On the API:

  1. Create a model called RevenueTag. It should extend ResourceModel and have the following fields: a. display: (unique and case insensitive) - Charfield with maxlength 256 (This will be the name of the revenue tag) b. created_by: FK to Authenticationmanager.User c. is_core: boolean with a default of false (each provider will have core default revenue tags which cannot be deleted. We will use this flag to identify which tags these are) d. Organization: FK to Organization

  2. Update the Organization.create method such that if the type of the organization is PROV, then the following revenue tags will be created: a. Name="Other", created_by=self.owner, organization=self, is_core=True, organization=self
    b. Name="Pharmacy", created_by=self.owner, organization=self, is_core=True, organization=self

  3. Extend the Healthcareservice, Stock and ChargeItem model with the following properties: a. revenue_tag: FK to RevenueTag
    b. revenue_tag_display: Charfield with maxlength 256
    Whenever instances of the Healthcareservice model are saved, do the following:
    a. if revenue_tag_display is not None, get revenue_tag with the display of revenue_tag_display and set it to self.revenue_tag
    b. else get the revenue tag of that organization with the display of Other and set that revenue_tag and revenue_tag_display

  4. Extend the HealthcareserviceSerializer to expose the revenue_tag_display property Whenever instances of the Stock model is saved, do the following:
    a. if revenue_tag_display is not None, get revenue_tag with the display of revenue_tag_display and set it to self.revenue_tag
    b. else get the revenue tag of that organization with the display of Pharmacy and set that revenue_tag and revenue_tag_display

Whenever instances of the ChargeItem model is created, do the following: a. If the service category is medication, get the revenue tag of the related stock item and set the revenue_tag and revenue_tag_display of the charge item instance
b. else get the revenue tag of the related Healthcare service and set the revenue_tag and revenue_tag_display of the charge item instance
c. if these throw an error, then get the revenue tag of that organization named Other and set that revenue_tag and revenue_tag_display
** Implement this behavior in a method named set_revenue_tag so can be called on the charge item instance

NB: You will need to extend the ChargeItem model to have a foreign key to the Stock model to simply this task. It will also help with other features and BI moving forward

Be sure to catch necessary exceptions

  1. Implement a API view for provider revenue tags a. This endpoint should be registered under provider.valueset.views and implemented like diagnostics.views.DiagnosticTestCodeValuesetListView b. In addition to the above, you need to filter and return revenue tags that belong to a specific provider c. Register this API view in provider.valueset.urls with the path name /<provider_id>/revenue-tag-type d. Document this API on readme under the provider portal in a new section titled "valuesets" The endpoint will be {{base_url}}/providers/<provider_id>/revenue-tag-type

NB: Be sure to remove the unique_together constraint in the healthcare service migration that will raise a bug. Ref: #82

On the frontend, Extend Healthcare service create and edit use cases such it it allows users to save the revenue tag based on values from {{base_url}}/providers/<provider_id>/revenue-tag-type

API endpoint can be found here

Describe alternatives you've considered N/A

Additional context N/A

chris-dare commented 2 years ago

Hi @TuyizereBapt I'm yet to complete the description for this issue and will notify you once complete

chris-dare commented 2 years ago

Hi @TuyizereBapt,

I'm done updating the issue. This is a task due next Tuesday

chris-dare commented 2 years ago

@TuyizereBapt @seddie62 do you have any questions on this task?

TuyizereBapt commented 2 years ago

Hey @dexios1 what should happen for new HealthCareServices, Stocks and ChargeItems for already existing provider organizations without RevenueTags set ye?

chris-dare commented 2 years ago

Hey @dexios1 what should happen for new HealthCareServices, Stocks and ChargeItems for already existing provider organizations without RevenueTags set ye?

For HealthcareService, the revenue tage display default should be "Other"

For Stock, it should be "Pharmacy"

For ChargeItem, it should be None

TuyizereBapt commented 2 years ago

Hey @dexios1 what should happen for new HealthCareServices, Stocks and ChargeItems for already existing provider organizations without RevenueTags set ye?

For HealthcareService, the revenue tage display default should be "Other"

For Stock, it should be "Pharmacy"

For ChargeItem, it should be None

I get that. But remember it's just revenue_tag_display field only, there is also revenue_tag ForeignKey field. Do you mean this foreign key can be set to null in such a case?

TuyizereBapt commented 2 years ago

Done. Up for review now

Here is the PR

chris-dare commented 2 years ago

Noted. Will check it out

seddie62 commented 2 years ago

@dexios1 have you merged it?

chris-dare commented 2 years ago

Just did

Kind regards, Chris Dare

E: @.**@.> P: +233 26 226 0986 / +250 786 745 117<tel:+233%2026%20226%200986%20/%20+250%20786%20745%20117> W: http://chrisdare.mehttp://chrisdare.me/ [LinkedIn]https://linkedin.com/in/csdare/[Twitter]https://twitter.com/chrisdare_


From: seddie62 @.> Sent: Thursday, March 3, 2022 9:45:09 AM To: serenity-health/roadmap @.> Cc: Chris Dare @.>; Mention @.> Subject: Re: [serenity-health/roadmap] feature/set up revenue tags for reporting (Issue #101)

@dexios1https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdexios1&data=04%7C01%7C%7Cea250b3517ee45dbebd608d9fcfa81a8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637818975114084795%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=bj2qafIeYw7u6qG8oeEONCLzX%2F56g6wYsvo8xp9oHf0%3D&reserved=0 have you merged it?

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fserenity-health%2Froadmap%2Fissues%2F101%23issuecomment-1057861668&data=04%7C01%7C%7Cea250b3517ee45dbebd608d9fcfa81a8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637818975114084795%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=5sZm64PP7q6MOdRP76u%2FUQQfufyMdsuocm4EzfGq7dM%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAEMSXLMTWW6ZDBDCGAR5HGTU6CC2LANCNFSM5OVUI7GA&data=04%7C01%7C%7Cea250b3517ee45dbebd608d9fcfa81a8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637818975114084795%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=SHODAy%2Frsbnp7sAhswIomjFov%2BIWIebKZiG%2BNSwiejI%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

chris-dare commented 2 years ago

Hi @seddie62 please let me know when this is integrated on the frontend

seddie62 commented 2 years ago

@dexios1 @TuyizereBapt what is the api needed here to get all possible values and what is the field to be added

chris-dare commented 2 years ago

Hey @dexios1 what should happen for new HealthCareServices, Stocks and ChargeItems for already existing provider organizations without RevenueTags set ye?

For HealthcareService, the revenue tage display default should be "Other" For Stock, it should be "Pharmacy" For ChargeItem, it should be None

I get that. But remember it's just revenue_tag_display field only, there is also revenue_tag ForeignKey field. Do you mean this foreign key can be set to null in such a case?

@TuyizereBapt sorry, I missed this. I think it depends on the final implementation. If the default revenue tags are set up, then there's no need for nullables, but if they aren't, then there's a need for that.

chris-dare commented 2 years ago

@dexios1 @TuyizereBapt what is the api needed here to get all possible values and what is the field to be added

Hi @seddie62,

the field's key is revenue_tag_display. Please give this a label of "Revenue tag"

This is the endpoint to get all possible values: {{base_url}}/providers/<provider_id>/revenue-tag-type

@TuyizereBapt please share the link to the API spec with @seddie62

TuyizereBapt commented 2 years ago

@dexios1 @TuyizereBapt what is the api needed here to get all possible values and what is the field to be added

Hi @seddie62,

the field's key is revenue_tag_display. Please give this a label of "Revenue tag"

This is the endpoint to get all possible values: {{base_url}}/providers/<provider_id>/revenue-tag-type

@TuyizereBapt please share the link to the API spec with @seddie62

Here is the API spec: https://serenity-health.readme.io/reference/valuesets

seddie62 commented 2 years ago

is the field required? @dexios1 @TuyizereBapt

seddie62 commented 2 years ago
Screenshot 2022-03-10 at 6 25 19 AM Screenshot 2022-03-10 at 6 25 11 AM

So I'm guessing this hasn't been merged? @dexios1

TuyizereBapt commented 2 years ago

Here is the API spec: https://serenity-health.readme.io/reference/valuesets

seddie62 commented 2 years ago

@TuyizereBapt I'm referring to the actual field revenue_tag_display on the services API, is that required?

TuyizereBapt commented 2 years ago

No. It will be set to default value if you do not provide a revenue_tag_display value on creation

chris-dare commented 2 years ago

Hi @seddie62 @TuyizereBapt,

I'm just reviewing the API for the revenue tag valueset. @TuyizereBapt it needs to be {{base_url}}/providers/{{serenity_user_provider_id}}/valueset/revenue-tags and registered in provider.valueset.urls

chris-dare commented 2 years ago

@TuyizereBapt I'm referring to the actual field revenue_tag_display on the services API, is that required?

Yes, Jean is right the API will do that. @seddie62 what you need to do on the frontend is to set the revenue tag to the default of "Other" for healthcare services. You need to do this so that users are not confused on how the defaults will be set up

@pkdadson for stock items, this will be "Pharmacy"

TuyizereBapt commented 2 years ago

I don't think that url is possible considering that the sub paths for valueset under provider do not have

Example: provider.urls - path("/valueset/", include("provider.valueset.urls")),

For the above url to work, it would require the above url to path("/<provider_id>/valueset/", include("provider.valueset.urls")),

I don't think that url is possible considering that the sub paths for valueset under provider do not have

Example: provider.urls - path("/valueset/", include("provider.valueset.urls")),

For the above url to work, it would require the above url to be altered to path("/<provider_id>/valueset/", include("provider.valueset.urls")),

chris-dare commented 2 years ago

I don't think that url is possible considering that the sub paths for valueset under provider do not have Example: provider.urls - path("/valueset/", include("provider.valueset.urls")), For the above url to work, it would require the above url to path("/<provider_id>/valueset/", include("provider.valueset.urls")),

I don't think that url is possible considering that the sub paths for valueset under provider do not have

Example: provider.urls - path("/valueset/", include("provider.valueset.urls")),

For the above url to work, it would require the above url to be altered to path("/<provider_id>/valueset/", include("provider.valueset.urls")),

Ah...got it. Alright. Then this is fine. Thanks a lot!