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

Move "public" resources into R4 Project #2591

Merged
merged 14 commits into from
Sep 12, 2023
Merged

Move "public" resources into R4 Project #2591

merged 14 commits into from
Sep 12, 2023

Conversation

mattwiller
Copy link
Member

@mattwiller mattwiller commented Aug 1, 2023

Creates a special Project for holding the base R4 FHIR specification conformance resources. The goal is to allow inclusion of those resources into other projects effectively via reference, so the hundreds of StructureDefinition and other resources do not live in each Project separately. This change includes:

  • Creation of an R4 project with a well-known ID (the V5 UUID generated for name "R4" under the Nil UUID namespace
  • A database migration to move all "orphan" resources into the R4 project at server startup
  • Updates to the seed script to create spec definition resources in the R4 project at first server startup
  • Login in the Repository to add the R4 Project compartment to all DB read queries; blocking all writes across project boundaries

Related to #2581

@vercel
Copy link

vercel bot commented Aug 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
medplum-storybook ⬜️ Ignored (Inspect) Visit Preview Sep 12, 2023 2:19am
medplum-www ⬜️ Ignored (Inspect) Visit Preview Sep 12, 2023 2:19am

@mattwiller mattwiller self-assigned this Aug 1, 2023
@mattwiller mattwiller added the fhir-datastore Related to the FHIR datastore, includes API and FHIR operations label Aug 1, 2023
@coveralls
Copy link

coveralls commented Aug 1, 2023

Coverage Status

coverage: 94.246% (+0.01%) from 94.236% when pulling 61e8f7f on r4-project into c7291e6 on main.

@reshmakh reshmakh added this to the August 15, 2023 milestone Aug 3, 2023
@mattwiller mattwiller marked this pull request as ready for review August 10, 2023 20:28
@mattwiller mattwiller requested a review from a team as a code owner August 10, 2023 20:28
@mattwiller mattwiller marked this pull request as draft August 10, 2023 20:28
@mattwiller mattwiller marked this pull request as ready for review August 15, 2023 17:28
@mattwiller mattwiller marked this pull request as draft August 15, 2023 17:36
@mattwiller mattwiller marked this pull request as ready for review August 15, 2023 20:35
@reshmakh
Copy link
Member

reshmakh commented Sep 6, 2023

Discussed - test in staging. @mattwiller @codyebberson

Copy link
Member

@codyebberson codyebberson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this looks good.

I'll deploy to staging when I get a chance. Assuming that looks good, then this is good-to-go 👍

@@ -113,12 +113,14 @@ function getResourceTypesByExportLevel(exportLevel: string): ResourceType[] {
return getResourceTypes();
}

const unexportedResourceTypes = ['CodeSystem', 'SearchParameter', 'StructureDefinition', 'ValueSet'];

function canBeExported(resourceType: string): boolean {
if (resourceType === 'BulkDataExport') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we're introducing unexportedResourceTypes, should we move the BulkDataExport into that?

Then this method becomes return !protectedResourcesTypes.includes(resourceType) && !unexportedResourceTypes.includes(resourceType)

const updateQuery = `UPDATE "__TABLE__" SET
"projectId" = $1::UUID,
compartments = ARRAY[$1]::UUID[],
content = jsonb_set(content::jsonb, '{meta, project}'::text[], to_jsonb($1), true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clever

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😅

@codyebberson
Copy link
Member

codyebberson commented Sep 11, 2023

Staging deploy failed:

image

Does the migration handle the case where the resource is deleted, and the content column is empty?

compartments = ARRAY[$1]::UUID[],
content = jsonb_set(content::jsonb, '{meta, project}'::text[], to_jsonb($1), true)
WHERE
"projectId" IS NULL OR "projectId" = $1`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might need to add AND "content"<>''

@sonarcloud
Copy link

sonarcloud bot commented Sep 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

96.6% 96.6% Coverage
0.0% 0.0% Duplication

@codyebberson codyebberson added this pull request to the merge queue Sep 12, 2023
Merged via the queue into main with commit b27c840 Sep 12, 2023
12 checks passed
@codyebberson codyebberson deleted the r4-project branch September 12, 2023 22:42
codyebberson added a commit that referenced this pull request Sep 13, 2023
Use data migrations in version numbers (#2816)
Fixes #2784 - Data migrations framework (#2786)
Fixes #2817 - add jose to bot lambda layer (#2818)
Move "public" resources into R4 Project (#2591)
fix(auth/external): add some missing url params for external auth `PKCE` exchanges (#2812)
Experiment: remove prettier from ESLint config, try out Biome (Rome fork) (#2748)
Fixes #2808 - handle observation groups in DiagnosticReportDisplay (#2809)
Adding content for Titan case study (#2806)
QuestionnaireForm Cleanup (#2801)
UI Clone for Lab Order Questionnaire (#2787)
Lab order bot (#2791)
Blog Post: GraphQL vs. Rest (#2781)
Fixes #2761 - docs for bot logs and aws athena (#2779)
Adding EMPI documentation (#2754)
Example on Lab Ordering demo (#2716)
Fixed links on about page (#2777)
Adding blog material (#2776)
Fixes #2771 - handle numeric return values from bots (#2775)
New www 'about' page (#2770)
github-merge-queue bot pushed a commit that referenced this pull request Sep 13, 2023
Use data migrations in version numbers (#2816)
Fixes #2784 - Data migrations framework (#2786)
Fixes #2817 - add jose to bot lambda layer (#2818)
Move "public" resources into R4 Project (#2591)
fix(auth/external): add some missing url params for external auth `PKCE` exchanges (#2812)
Experiment: remove prettier from ESLint config, try out Biome (Rome fork) (#2748)
Fixes #2808 - handle observation groups in DiagnosticReportDisplay (#2809)
Adding content for Titan case study (#2806)
QuestionnaireForm Cleanup (#2801)
UI Clone for Lab Order Questionnaire (#2787)
Lab order bot (#2791)
Blog Post: GraphQL vs. Rest (#2781)
Fixes #2761 - docs for bot logs and aws athena (#2779)
Adding EMPI documentation (#2754)
Example on Lab Ordering demo (#2716)
Fixed links on about page (#2777)
Adding blog material (#2776)
Fixes #2771 - handle numeric return values from bots (#2775)
New www 'about' page (#2770)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fhir-datastore Related to the FHIR datastore, includes API and FHIR operations
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants