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

Dc 199 improvements justice data #598

Merged
merged 29 commits into from
Aug 5, 2024
Merged

Conversation

LavMatt
Copy link
Contributor

@LavMatt LavMatt commented Jul 26, 2024

This PR updates find-moj-data to be align with enhanced metadata for justice data - PR here ministryofjustice/data-catalogue#220

Dashboard and Charts

Primarily it adds the following for dashboards and charts:

  • Displays the extra metadata captured for each individual justice-data chart. This includes some new properties for refresh period, last updated, and access requirements - all of which were not previously populated with values resulting from a datahub graphql query.
  • The above, refresh period, last updated, and access requirements have been added as properties to existing pydantic models falling under custom_properties of the Entity model.
  • Adds a new entity type - Dashboard. They will now be returned in search results (added as result type and to client's search method and are an option for entity type filter.
  • Adds new DashboardDetailsService class to return the context used by the dashboard_details template to render dahsboard details page.
  • Adds a new graphql query to get dashboard details.
  • Adds breadcrumb to chart detail page.
  • The ticket to redesign the contact template has not been done as part of this. That will further improve the presentation of contact info for charts - Plus the justice-data api should be having some non-default contact emails added.
  • An access_requirments property has been added to the

Charts in search results:
image

Chart details:
image

Refactor

I have also refactored the datahub client and how entity relationships are handled and have standardised this somewhat - with the introduction of dashboard entities we have two parent type entities and they would've required divergent relationship approaches in order to list their children entities. I have hence changed how database relations are populated and the approach is now cleaner and uniform.
This includes:

  • Adds a EntitySummary pydantic model in the datahub client. This includes the EntityRef and some more summary information that is useful to store for quick reference: description, tags, entity_type. This is now used in the relationship property of the entity class.
  • Adds CHILD RelationshipType enum.
  • Removed tables property from databases. Both dashboards and databases now just use the relationships property from the base Entity model to hold metadata relating to child entities.
  • Refactored parse_relations in graphql_helpers to parse the extra information.
  • Changed the getContainerDetails graph query to return relations in similar format to other getDetails... queries
  • Aligned all client methods that parse relations to do so in a consistent way - and added a single method to list relations to display to the client - put this as a client method, just because it's not directly parsing any graphql results.

As this ticket has already grown pretty large i decided against including some of the other refactoring planned for future sprints - opting to focus on improving how we are handling entity relationships - E.g. points in this issue have not really been addressed #574

@LavMatt LavMatt force-pushed the dc-199-improvements-justice-data branch from 7f39389 to 9d8af01 Compare July 30, 2024 11:06
@LavMatt LavMatt marked this pull request as ready for review July 31, 2024 10:53
@LavMatt LavMatt requested a review from a team as a code owner July 31, 2024 10:53
@murdo-moj
Copy link
Contributor

seems to deploy alright. I can see dashboards in dev now.

@murdo-moj
Copy link
Contributor

Big PR! Well executed. The writeup is really helpful as well.⚡ ⚡

@LavMatt LavMatt merged commit 55a7d6c into main Aug 5, 2024
5 of 6 checks passed
@LavMatt LavMatt deleted the dc-199-improvements-justice-data branch August 5, 2024 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants