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

Migrate to GraphQL #140

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

Migrate to GraphQL #140

wants to merge 11 commits into from

Conversation

codecakes
Copy link
Contributor

@codecakes codecakes commented Feb 3, 2025

Changes are as per: https://github.com/myhealthconnectsociety/project-healthcare/blob/715df4a91a4a6b0ff09c4c7915c5e4ff40843919/docs/roadmap.md

Summary by Sourcery

Introduce a GraphQL API with initial mocked data for patients, diagnosis queries, and facilities.

New Features:

  • Implemented a GraphQL API using Strawberry GraphQL.

Tests:

  • Added a GraphQL test application that can be run with hypercorn.

@codecakes codecakes added this to the v1 milestone Feb 3, 2025
@codecakes codecakes self-assigned this Feb 3, 2025
Copy link
Contributor

sourcery-ai bot commented Feb 3, 2025

Reviewer's Guide by Sourcery

This pull request migrates the project to use GraphQL for its API. It includes the initial setup of the GraphQL schema, resolvers with mocked data, and necessary configurations. The changes also include updates to the project's documentation and dependencies.

Sequence diagram for GraphQL query flow

sequenceDiagram
    participant Client
    participant GraphQL
    participant Resolver
    participant MockData

    Client->>GraphQL: Query (patients/diagnosis/facilities)
    GraphQL->>Resolver: Forward Query
    Resolver->>MockData: Get Mock Data
    MockData-->>Resolver: Return Mocked Response
    Resolver-->>GraphQL: Resolved Data
    GraphQL-->>Client: Query Response
Loading

Class diagram for GraphQL types and models

classDiagram
    class Patient {
        +str cust_id
        +str query
        +GeoLocation geo_location
    }

    class Provider {
        +str id
        +str name
    }

    class Query {
        +patients(): List[PatientType]
        +diagnosis(): DiagnosisQueryType
        +facilities(): FacilitiesResultType
    }

    class FacilitiesResultType {
        +str name
        +AddressType address
        +GeoLocationType geolocation
        +str contact
        +str facility_type
        +str ownership
        +List[str] specialties
        +int stars
        +int reviews
        +int rank
        +float estimated_time
    }

    Query ..> Patient: returns
    Query ..> Provider: returns
Loading

File-Level Changes

Change Details Files
GraphQL schema definition and initial resolvers
  • Defined GraphQL types for Patient, Query, and other related entities.
  • Implemented initial resolvers with mocked data for queries like patients, diagnosis, and facilities.
  • Set up a basic GraphQL schema using Strawberry.
xcov19/app/graphql/schema.py
xcov19/app/graphql/resolvers.py
Updated documentation to reflect GraphQL changes
  • Modified the roadmap to include GraphQL schema design and implementation details.
  • Updated the task list to reflect the new GraphQL queries.
  • Added a section for quickly testing the GraphQL application.
docs/roadmap.md
Added GraphQL dependencies and updated project configuration
  • Added strawberry-graphql to the project dependencies.
  • Updated poetry.lock to include the new dependency.
pyproject.toml
poetry.lock
Added GraphQL inputs
  • Added PatientInput for GraphQL mutations.
xcov19/app/graphql/inputs.py
Updated Patient model
  • Added a default value to the geo_location field.
xcov19/domain/models/patient.py
Removed unused file
  • Removed the common.py file.
xcov19/domain/common.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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.

1 participant