Aidbox / Issues

Issue tracker for Aidbox FHIR backend by Health Samurai
7 stars 0 forks source link

Create flat views with View Definitions on startup app #569

Open zakharych opened 7 months ago

zakharych commented 7 months ago

Question

Hi, I am attempting to create flat views using View Definitions upon application startup. I am using the aidbox-python-sdk, not the Zen project. I create ViewDefinitions.yaml resources similar to my other resources such as Mappings and AidboxQueries.

However, upon app startup, only the ViewDefinition resource is available, and a flat view isn't created. When I attempt to execute select * from sof.my_view_name, I receive an error sof.my_view_name not found.

The flat view is only generated when I click the 'save' button in the View Definitions tab for my resource.

How can I create View Definitions and flat views during app initialization? I require this for automatically testing my queries.

Nesmeshnoy commented 7 months ago

@zakharych what is your Aidbox version? This behavior was fixed in Aidbox's September 2109 release.

Could you please share the ViewDefinitons you're working with? It'll help us to reproduce.

zakharych commented 7 months ago

@Nesmeshnoy
Aidbox version - 2311 Exact message error ERROR: relation "sof.test_patient_view" does not exist

ViewDefenition resource:

name: test_patient_view
resource: Patient
description: Patient flat view
status: active
extension:
  - url: materialization
    value:
      code: view
select:
  - alias: id
    path: id
  - alias: bod
    path: birthDate
  - alias: gender
    path: gender
zakharych commented 6 months ago

@Nesmeshnoy I've also created a simple Aidbox Zen project where I defined two ViewDefinitions in the seed, and I'm encountering the same issue. The view in the database doesn't exist during startup; it only appears after I manually resave it in ui. https://github.com/zakharych/zen-project-sof

Same for ndjson.gz seeds