SkySutra: the finished app
==========================

skysutra-app-course.sql is the whole SkySutra app as it stands at the end of Part 12:
27 pages, the plugins, the styles and icons, the AI agent, the workflow and the
automations. There's one export for the whole course, not one per part. Build it yourself
part by part; use this to compare with yours, or to see where a part is heading.

The app needs its database objects, which it doesn't create. Do the steps in this order.
https://kathuko.com/apex2/part-12/ has the same notes.


1. Run the scripts that don't need the catalog
   SQL Workshop > SQL Scripts (or SQL Commands), in this order:
     skysutra_schema.sql  skysutra_seed.sql  skysutra_auth.sql
     skysutra_math.sql  skysutra_planets.sql  skysutra_rise_set.sql
     skysutra_iss.sql   skysutra_iss_tests.sql   (this one also loads today's ISS passes)
     skysutra_live.sql  skysutra_tonight.sql  skysutra_chart.sql  skysutra_explore.sql
     skysutra_places.sql  skysutra_observations.sql  skysutra_calendar.sql
     skysutra_signs.sql  skysutra_jobs.sql  skysutra_share.sql
   The home page reads views and packages from these, so the app can't open without them.
   The tests (skysutra_math_tests.sql, skysutra_rise_set_tests.sql) are optional checks.
   Every script is safe to run again. Tables and indexes are made only if they're missing,
   and the seed only adds rows that aren't there: it never deletes yours. So if one stops
   with an error, fix the cause and run the whole list again from the top.
   skysutra_calendar.sql re-creates the published sky events (NASA, IMO, AMS) on every run;
   your own data is kept.

2. Import the app
   App Builder > Import. Choose this file, File Type: Database Application, Page or
   Component Export. Install it with "Auto Assign New Application ID", so it never replaces
   an app you have.
   Two credentials ask for a value while it installs:
     Credentials for turnout ai                 your Gemini API key (the one from Turnout)
     Credentials for NASA picture of the day    your api.nasa.gov key, or DEMO_KEY
   If your workspace already has the Turnout AI service, the import reuses it.

3. Load the star catalog
   First make yourself an administrator. Roles come across in an export; the people in
   them don't, and page 20 (like the Jobs and Write a Panel pages) is for the
   Administrator role only. Shared Components > Application Access Control > Add User
   Role Assignment: your own user name, tick Administrator (Lesson 2.6).
   Then make the error table the Constellation Lines load writes its bad rows to
   (Lesson 2.4), in SQL Commands:
       begin dbms_errlog.create_error_log('SS_CONSTELLATION_LINES'); end;
   Then run the app, open page 20 (Load the Catalog, alias "load") and load the four CSVs from
   Part 2, in this order: constellations.csv, bright_stars.csv, constellation_lines.csv,
   nakshatra_stars.csv.

4. Run the two scripts that need the catalog
     skysutra_lore.sql   skysutra_ask.sql
   Their stories are tied to stars, constellations and nakshatras, so they come after
   step 3. Running them again is safe: a story is added if its title is missing, and
   changed only if its text differs. Your own stories and all embeddings are kept.

5. Set what the export can't carry
   - Workflow and task: the workflow owner and the task's business administrator were set
     to ADMIN. Shared Components > Workflows > Observation Review > Participants, and
     Task Definitions > Review an Observation > Participants: change ADMIN to your own
     user name.
   - Moderator: Shared Components > Application Access Control: assign Moderator to
     someone (Lesson 0.6).
   - Test people: create the APEX accounts from Lesson 0.6 if you want to sign in as them.
   - Push: Shared Components > Progressive Web App > Push Notifications: regenerate the
     credentials. Keys never leave a workspace.
   - Google sign-in (optional): the "Google sign-in" credential comes across empty. Put in
     your own client ID and secret (Lesson 0.6). The app signs in with Oracle APEX
     Accounts until you switch.
   - Automations: Nightly sky, Sky alerts and Weekly sky email arrive Active. If you have
     another copy of SkySutra in the same workspace, disable them in one of the two.

6. Fill it
   - Jobs (page 80): Run Now. In about four minutes it has fetched the live data and
     worked out rise and set times, the calendar and the panchang.
   - Embeddings for Ask the sky (Part 11), in SQL Commands:
       begin ss_ask.refresh_star_texts; ss_ask.refresh_embeddings; end;
     The free Gemini tier allows about 100 a minute, so this takes a few minutes.

Questions: https://kathuko.com/apex2/
