Welcome to the NAA Software! This software computes the concentrations of radioactive isotopes in unknown materials.
Neutron Activation Analysis uses a nuclear reactor to determine concentrations of isotopes. The idea is to irradiate both the known and unknown materials and compare the counts of neutrons measured by the detector. This software uses properties of the isotopes, materials, and irradiations to compute the unknown concentrations.
Everything you need to build a Svelte library, powered by sv.
Read more about creating a library in the docs.
Once you've created a project and installed dependencies with npm install (or pnpm install or yarn), start a development server:
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --openEverything inside src/lib is part of your library, everything inside src/routes can be used as a showcase or preview app.
To build your library:
npm packTo create a production version of your showcase app:
npm run buildYou can preview the production build with npm run preview.
To deploy your app, you may need to install an adapter for your target environment.
This project now includes an integrated Azure Functions backend under api/ for use with Azure Static Web Apps.
GET /api/isotopesPOST /api/isotopes
The frontend isotope viewer calls /api/isotopes by default. You can override that by setting PUBLIC_ISOTOPE_API_URL.
The integrated Azure Functions endpoint stays at authLevel: 'anonymous', because Azure Static Web Apps is the layer that authenticates and authorizes requests before forwarding them to the function.
POST /api/isotopes is locked down in two places:
staticwebapp.config.jsonallows only the customisotope_writerrole to call that method.- The function independently validates the forwarded
x-ms-client-principalheader and rejects callers that do not have the same role.
That second check matters because it prevents an accidental config regression from silently opening write access.
GET /api/isotopes remains available with the current app behavior. If you also want reads restricted, add a matching GET route rule with the roles you want.
Important limitation: this is still a browser-callable API. Any user who has the isotope_writer role can invoke the write endpoint from the browser or other clients while signed in. If writes must only come from trusted backend automation, move the write path behind a separate backend service that is not directly exposed to browser users.
To grant access, assign the isotope_writer role in Azure Static Web Apps invitations/role assignments.
POST /api/isotopes expects JSON in this shape:
{
"elementName": "Cobalt",
"shortName": "Co",
"massNumber": 60,
"suffix": "m",
"energies": [1173.2, 1332.5],
"halfLife": {
"number": 5.2714,
"unit": "years"
}
}The function derives:
- a GUID
id halfLifeSeconds- audit metadata such as
createdAtandcreatedBy
If the isotope already exists, the function updates that existing document and appends any new energies that are not already present.
Set these application settings in Azure Static Web Apps:
COSMOSDB_ENDPOINTCOSMOSDB_KEYCOSMOSDB_DATABASECOSMOSDB_CONTAINERISOTOPE_WRITE_ROLE(optional, defaults toisotope_writer)COSMOSDB_QUERY(optional, defaults toSELECT * FROM c)
The included sample file is api/local.settings.sample.json.
Install the API dependencies:
cd api
npm installTo run the integrated Static Web App locally, use the Azure Static Web Apps CLI or Azure Functions Core Tools with the Svelte app and the api/ folder together.
Use these Azure Static Web Apps settings:
- App location:
/ - API location:
api - Output location:
build